Bonga How it works
Your app keeps the users,
Bonga keeps the conversations
Every app that uses Bonga has its own users, keys, rules and data, invisible to every other app. This is who talks to Bonga, and with what.
Read the quick start
https://bonga.foxshard.com/api/v1
Who talks to Bonga, and with what
- Your front end
- The web page or mobile app your users chat in. It talks to Bonga directly, over REST and one WebSocket, with a user token your server fetched for it. It may do what that user may: reach the conversations they are in, by the rules of their role.
- Your server
- Talks to Bonga with the app's API key and may do everything within the app. Bonga tells it what happens through webhooks, which is how it sends push notifications to people who are not connected.
- Bonga
- Holds the conversations, the messages and the files, and tells everybody concerned what changes, on one node or on many.
The parts, in Bonga's words
- App
- A tenant: one application that uses Bonga. Everything belongs to exactly one app, with its own users, keys, rules and data.
- User
- Known to Bonga by the id your application already has for them. You never store a user id of Bonga's, and none is ever shown. Users are not registered: the first time your server mentions one, by asking for a token or adding them to a conversation, they exist.
- API key
- Starts with
bga_and is held by your server. It may do everything within the app, and with the headerX-Bonga-Userit acts as that user. It is shown once, when it is made; only its hash is kept. - User token
- A signed token your server asks for, for one user, and hands to your front end. It lasts 24 hours unless you ask for less or more, 7 days at most, or until the user is signed out everywhere.
- Webhook
- An endpoint of yours that Bonga posts the events of your app to, signed and retried.
What each credential can do
| Question | API key | User token |
|---|---|---|
| Held by | Your server | Your front end |
| May do | Everything within the app, or act as one user | What that user may: only the conversations they are in, by the rules of their role |
| Limited | For the whole app, far above what a person does | Per user |
| Stops working | When it is revoked or reaches its expiry, at once on every node | When it expires, or when the user is signed out everywhere |
If your users already sign in with an OpenID Connect provider, Bonga can accept its tokens directly, so that no token of ours is needed. Credentials says how.
A conversation can be yours
Often a conversation belongs to something of yours: an order, a ride, a ticket. Give it that thing's id and never keep one of Bonga's. Your server makes sure of the conversation of order order-10247 and of who is in it, as often as it likes, and closes it when the order is done: nobody but your server writes in it any more, and it can still be read.