How to submit a sendMessage request on Postman
Verb
- POST
URL
- https://chat.stream-io-api.com/channels/{{channel type}}/{{channel id}}/message?api_key={{api key}}
- This URL includes
- Region - us-east
- Channel type
- Channel id (not cid)
- Api key (not needed if provided in Authorization tab)
Authorization
- Type
- Inherit auth from parent - If included in URL
- API Key - If not included in URL
- Key = api_key
- Value = YOUR API KEY
- Add to = Header
Headers - no quotes ("") around values
- Stream-Auth-Type
- jwt
- Authorization
- YOUR TOKEN
- Content-Type
- application/json
Body
- raw
- JSON
{
"message" :
{
"text" : "Hello World",
// include user object only if server side - change token to dev-token
"user" : { "id" : "Lakshmi" }
"message_type": "system" // custom data
}
}
The API will not allow a user object to be sent in the message object if posting a message client-side. The user_id is already present in your included token.
If attempted, the API will return this error:"message": "SendMessage failed with error: \"Setting message.user or message.user_id is only allowed when using server side auth.\""
Comments
0 comments
Please sign in to leave a comment.