Chat API Docs
Welcome to the Chat API docs!
API base:
https://chat-api.connectnow.org.uk
IMPORTANT
Make sure to familiarize yourself with the API philosophy before proceeding with this guide.
Authentication
Because of the nature of Chat and specifically the ability to converse without having an account, two types of tokens exist for authentication depending on what you're trying to access.
Also see: API Philosophy - authentication
The two types of tokens
- API tokens are usual tokens that you use to authenticate most API requests. These follow our API philosophy on authentication using
api_token
- Chat-user tokens are tokens that are scoped to a user in a given chat, and are required to interact as a given user in a given chat. These follow our API philosophy on authentication, but use
chat_user_token
instead
Response Status Codes
See: API Philosophy - status codes
Current user
Get authenticated via API token
GET /api/user
Get authenticated via chat-user token
GET /api/chat-user
Companies
Get all
GET /api/companies
Get single by ID
GET /api/companies/{company-id}
Create
POST /api/companies
Edit
PUT /api/companies/{company-id}
Delete
DELETE /api/companies/{company-id}
Chats
Get all
GET /api/chats
Get single by ID
GET /api/chats/{chat-id}
Create
POST /api/chats
Edit
PUT /api/chats/{chat-id}
Delete
DELETE /api/chats/{chat-id}
Chat users
Get all
GET /api/chats/{chat-id}/users
Get single by ID
GET /api/chats/{chat-id}/users/{chat-user-id}
Create
POST /api/chats/{chat-id}/users
Edit
PUT /api/chats/{chat-id}/users/{chat-user-id}
Delete
DELETE /api/chats/{chat-id}/users/{chat-user-id}
Chat messages
Get all
GET /api/chats/{chat-id}/messages
Get single by ID
GET /api/chats/{chat-id}/messages/{chat-message-id}
Create
POST /api/chats/{chat-id}/messages
Edit
PUT /api/chats/{chat-id}/messages/{chat-message-id}
Delete
DELETE /api/chats/{chat-id}/messages/{chat-message-id}
Users
Chat user-token
Get valid chat-user token
This endpoint is used to exchange a valid auth-code for a chat-user token, which can then be saved in something like the local-storage and is required when creating chat messages.
POST /chats/{chat-id}/users/get-token
Parameter | Type | Rules | Required | Default | Description |
---|---|---|---|---|---|
email | email | A valid email address | ✅ | - | Email of the person requesting a token |
auth-code | int | A valid auth code | ✅ | - | The auth code sent to the persons email |
Chat password
Get chat password
POST /chats/{chat-id}/share