messages

Sends 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:

  1. 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…"
}
  1. 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"
  }
  1. 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.

post/messages

Request

  • Base URL
    https://botapi.tamtam.chat
  • URL
    https://botapi.tamtam.chat/messages
  • Auth
    API key in query parameter access_token

Query parameters

user_idinteger

Fill this parameter if you want to send message to user

chat_idinteger

Fill this if you send message to chat

disable_link_previewboolean

If false, server will not generate media preview for links in text

Request body

textstring nullable required

Message text

notifyboolean

If false, chat participants would not be notified

format'markdown' | 'html'

Message text format

Response

Returns info about created message

Changes

    • info

      added highlighted discriminator mapping keys to the /////// response property for the response status

    • info

      added highlighted discriminator mapping keys to the //////////// response property for the response status

    • info

      removed code discriminator mapping keys from the /////// response property for the response status

    • info

      removed code discriminator mapping keys from the //////////// response property for the response status

    • 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