Docs Quick start

Quick start

From an API key to a first message, with curl.

Documentation

You need an API key. They are not given out on this site yet: write to support@foxshard.com and say what your app is. In the commands below the key is $KEY.

From a terminal, where $KEY is the API key:

API=https://bonga.foxshard.com/api/v1

# Your server: a token for alice (who is created by being named), and one for bob
ALICE=$(curl -s -X POST $API/tokens -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' \
        -d '{"userId":"alice","name":"Alice"}' | jq -r .token)
curl -s -X POST $API/tokens -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' \
     -d '{"userId":"bob","name":"Bob"}' > /dev/null

# Alice's front end: the conversation with bob (asked for again, it is the same one), and a message
CID=$(curl -s -X POST $API/conversations -H "Authorization: Bearer $ALICE" -H 'Content-Type: application/json' \
      -d '{"type":"DIRECT","memberIds":["bob"]}' | jq -r .id)
curl -s -X POST $API/conversations/$CID/messages -H "Authorization: Bearer $ALICE" \
     -H 'Content-Type: application/json' -d '{"text":"Habari Bob!"}'

# Your server, acting as bob: his list, with the unread count and a preview
curl -s $API/conversations -H "Authorization: Bearer $KEY" -H 'X-Bonga-User: bob'