Send message
Changed onSends a message to a chat. As a result for this method new message identifier returns.
Attaching media
Attaching media to messages is a three-step process.
At first step, you should obtain a URL to upload your media files.
At the second, you should upload binary of appropriate format to URL you obtained at the previous step. See upload section for details.
Finally, if the upload process was successful, you will receive JSON-object in a response body. Use this object to create attachment. Construct an object with two properties:
- type with the value set to appropriate media type
- and payload filled with the JSON you've got.
For example, you can attach a video to message this way:
- Get URL to upload. Execute following:
curl -X POST 'https://botapi.tamtam.chat/uploads?access_token=%access_token%&type=video'
As the result it will return URL for the next step.
{
"url": "https://vu.mycdn.me/upload.do…"
}
- Use this url to upload your binary:
curl -i -X POST
-H "Content-Type: multipart/form-data"
-F "data=@movie.mp4" "https://vu.mycdn.me/upload.do…"
As the result it will return JSON you can attach to message:
{
"token": "_3Rarhcf1PtlMXy8jpgie8Ai_KARnVFYNQTtmIRWNh4"
}
- Send message with attach:
{
"text": "Message with video",
"attachments": [
{
"type": "video",
"payload": {
"token": "_3Rarhcf1PtlMXy8jpgie8Ai_KARnVFYNQTtmIRWNh4"
}
}
]
}
Important notice:
It may take time for the server to process your file (audio/video or any binary). While a file is not processed you can't attach it. It means the last step will fail with 400 error. Try to send a message again until you'll get a successful result.
Request
- Base URLhttps://botapi.tamtam.chat
- URLhttps://botapi.tamtam.chat/messages
- AuthAPI key in query parameter access_token
Query parameters
Fill this parameter if you want to send message to user
Fill this if you send message to chat
If false, server will not generate media preview for links in text
Request body
Response
Returns info about created message
Changes
- info
added
highlighteddiscriminator mapping keys to the///////response property for the response status - info
added
highlighteddiscriminator mapping keys to the////////////response property for the response status - info
removed
codediscriminator mapping keys from the///////response property for the response status - info
removed
codediscriminator mapping keys from the////////////response property for the response status
- info
- info
added the new optional request property
- info
added the optional property
//////to the response with the status - info
added the optional property
///////////to the response with the status - info
added the required property
//////to the response with the status - info
added the required property
///////////to the response with the status - info
added the required property
//////to the response with the status
- info