Telegram Message Types
There are various types of message content that can be sent to your users:
Text
{
type: "TEXT",
text: "Hello World!",
}
| Property | Description | Required |
|---|---|---|
| type | TEXT | Y |
| text | String | Y |
Image
{
type: "IMAGE",
url: "http://image.png",
text: "Some title",
}
| Property | Description | Required |
|---|---|---|
| type | IMAGE | Y |
| url | URL of the image file | Y |
| text | String | N |
Tips:
- Image must be a valid image file format, including
.jpg,.jpegand.png - Maximum file size is 25MB
Audio
{
type: "AUDIO",
url: "http://audio.mp3",
}
| Property | Description | Required |
|---|---|---|
| type | AUDIO | Y |
| url | URL of the audio file | Y |
Tips:
- Audio must be a valid audio file format, including
.aac,.flac,.m4a,.m4p,.mp3,.wav,.wma - Maximum file size is 25MB
Video
{
type: "VIDEO",
url: "http://video.mp4",
text: "Some title",
}
| Property | Description | Required |
|---|---|---|
| type | VIDEO | Y |
| url | URL of the video file | Y |
| text | String | N |
Tips:
- Video must be a valid video file format, including
.mkv,.gif,.avi,.wmv,.rmvb,.mp4,.m4v,.mpg,.mpeg,.3gp - Maximum file size is 25MB
File
{
type: "FILE",
url: "http://file.pdf",
}
| Property | Description | Required |
|---|---|---|
| type | FILE | Y |
| url | URL of the file attachment | Y |
Tips:
- File must be a valid file format, including
.pdf - Maximum file size is 25MB
Animation
Animation is image file in GIF.
{
type: "ANIMATION",
url: "https://img.gif",
text: "Some title",
attachmentId: "SomeStringID"
}
| Property | Description | Required |
|---|---|---|
| type | ANIMATION | Y |
| url | URL of the image file | Y |
| text | String | N |
| attachmentId | String; ID of your uploaded image | N |
Tips:
- Image must be a valid image file format, including
.gif - Maximum file size is 25MB
Button
{
type: "Any Message Type",
url: "https://img.png",
text: "What can I do to help?",
buttons: [{
type: "postback",
title: "some title",
payload: "a long payload here"
}],
}
Response Object
| Property | Description | Required |
|---|---|---|
| type | Any message type specified above | Y |
| url | URL of the message content if message type is IMAGE, AUDIO, VIDEO, FILE or ANIMATION | N |
| text | String; applicable only if message type is TEXT | N |
| buttons | Array of buttons; only "postback" can be set as button type | Y |
buttons Object
| Property | Description | Required |
|---|---|---|
| type | postback | Y |
| title | String | Y |
| payload | Custom defined payload triggers | Y |
Keyboards
{
type: "Any Message Type",
url: "https://img.png",
text: "What can I do to help?",
keyboards: [
[
{ text: "Keyboard 1" },
{ text: "Keyboard 2" },
{ text: "Keyboard 3" }
]
]
}
Response Object
| Property | Description | Required |
|---|---|---|
| type | Any message type specified above | Y |
| url | URL of the message content if message type is IMAGE, AUDIO, VIDEO, FILE or ANIMATION | N |
| text | String; applicable only if message type is TEXT | N |
| keyboards | Array of keyboard buttons; only set keywords as triggers | Y |
keyboards Object
| Property | Description | Required |
|---|---|---|
| text | String; title of keyboard buttons | Y |
