Post Chat Room Message
Send Chat Room Message
https://api.deadsimplechat.com/consumer/api/v1/chatroom/:roomId/message
Post Chat Room Message
The auth
query parameter is your private key. You can find it in your Dashboard under Developer -> Private Key.
Send a Message into the Chat Room
Send Chat Room Message | description | |
---|---|---|
Parameters | ||
Path | ||
roomId | string | ID of the chat room where you want to send the message |
Query | ||
auth | string | Go to Dashboard -> Developer -> Private Key is your auth |
Body | ||
user | object | Create a user on the fly and send a message as the user. User object has the following properties: { "username": <Required username of the user>, "externalProfilePic":<Optional: URL of the ProfilePic> } |
userAccessToken | string | Access Token of the user, message will be sent by the user whose accessToken is provided (recommended way) |
systemMessage | boolean | Send this Message as System Message (recommended way) |
message | string | Message you want to send |
Responses Remaining
200
{
"success": true,
}
404
{
"message": "invalid chatroom id"
}
Either you have to send user
or userAccessToken
or systemMessage
only one has to be sent.
System Message: If you want the message to appear sent from the server, select the System Message
User: Sending the message as a User would create a new user, and the message would be sent as the user, the user-created would be just for the purpose of sending this message, is you want to send very low volume messages into the chat room with a new username and profile picture based on backend logic then you could this. Only use this if you have a use case where each message is sent as a new user which is programatically generated
User Access Token: If you want to send the message as another user, you can use this mode. It can be used un use-cases where user has replied via some other method e.g: via email and you can call this API on the backend to send the message into the Chat Room as the user.
It can also be used to build user interfaces for 3rd party bots, you can use the Create User API to create a user for the bot with a username and profile picture, and in the bot's configuration you can specify the accessToken and this API to allow the bot to send the messages into the Chat Room.