ByteChef LogoByteChef

Telegram

Telegram is a cloud-based messaging platform that enables users to send messages, media, and files, and supports automation and integrations through its API.

Categories: Communication

Type: telegram/v1


Connections

Version: 1

custom

Properties

NameLabelTypeDescriptionRequired
botTokenBot TokenSTRINGtrue

Connection Setup

Create a Telegram Bot and get the Bot Token

  1. In Telegram, start a chat with BotFather.
  2. Send the /newbot command and follow the prompts:
    • Choose a display name (can be changed later).
    • Choose a unique username that ends with bot (e.g., my_bytechef_bot).
  3. Copy the Bot Token provided by BotFather (format: 1234567890:AA...). Keep it secret.

Helpful links:


Actions

Send Media

Name: sendMedia

Sends a media message through a Telegram bot.

Properties

NameLabelTypeDescriptionRequired
chat_idChat IDSTRINGUnique identifier for the target chat or username of the target channel.true
mediaTypenullSTRING
Options document, photo, video
Type of media to send.true
documentDocumentFILE_ENTRYDocument to send.true
photoPhotoFILE_ENTRYPhoto to send.true
videoVideoFILE_ENTRYVideo to send.true
direct_messages_topic_idDirect Messages Topic IDSTRINGIdentifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat.false

Example JSON Structure

{
  "label" : "Send Media",
  "name" : "sendMedia",
  "parameters" : {
    "chat_id" : "",
    "mediaType" : "",
    "document" : {
      "extension" : "",
      "mimeType" : "",
      "name" : "",
      "url" : ""
    },
    "photo" : {
      "extension" : "",
      "mimeType" : "",
      "name" : "",
      "url" : ""
    },
    "video" : {
      "extension" : "",
      "mimeType" : "",
      "name" : "",
      "url" : ""
    },
    "direct_messages_topic_id" : ""
  },
  "type" : "telegram/v1/sendMedia"
}

Output

Type: OBJECT

Properties

NameTypeDescription
okBOOLEAN
Options true, false
resultOBJECT
Properties {INTEGER(message_id), INTEGER(message_thread_id), {INTEGER(topic_id), {INTEGER(id), BOOLEAN(is_bot), STRING(first_name), STRING(last_name), STRING(username)}(user)}(direct_messages_topic), {INTEGER(id), BOOLEAN(is_bot), STRING(first_name), STRING(last_name), STRING(username)}(from), {INTEGER(id), STRING(title), STRING(username), STRING(type), BOOLEAN(is_direct_messages)}(sender_chat), INTEGER(date), {INTEGER(id), STRING(title), STRING(username), STRING(type), BOOLEAN(is_direct_messages)}(chat), STRING(text), {INTEGER(topic_id), {INTEGER(id), BOOLEAN(is_bot), STRING(first_name), STRING(last_name), STRING(username)}(user)}(direct_messages_topic), {STRING(file_id), STRING(file_unique_id), {STRING(file_id), STRING(file_unique_id), INTEGER(width), INTEGER(height), INTEGER(file_size)}(thumbnail), STRING(file_name), STRING(mime_type), INTEGER(file_size)}(document), [{STRING(file_id), STRING(file_unique_id), INTEGER(width), INTEGER(height), INTEGER(file_size)}](photo), {STRING(file_id), STRING(file_unique_id), STRING(width), STRING(height), INTEGER(duration), STRING(file_name), STRING(mime_type), INTEGER(file_size)}(video)}

Output Example

{
  "ok" : false,
  "result" : {
    "message_id" : 1,
    "message_thread_id" : 1,
    "direct_messages_topic" : {
      "topic_id" : 1,
      "user" : {
        "id" : 1,
        "is_bot" : false,
        "first_name" : "",
        "last_name" : "",
        "username" : ""
      }
    },
    "from" : {
      "id" : 1,
      "is_bot" : false,
      "first_name" : "",
      "last_name" : "",
      "username" : ""
    },
    "sender_chat" : {
      "id" : 1,
      "title" : "",
      "username" : "",
      "type" : "",
      "is_direct_messages" : false
    },
    "date" : 1,
    "chat" : {
      "id" : 1,
      "title" : "",
      "username" : "",
      "type" : "",
      "is_direct_messages" : false
    },
    "text" : "",
    "document" : {
      "file_id" : "",
      "file_unique_id" : "",
      "thumbnail" : {
        "file_id" : "",
        "file_unique_id" : "",
        "width" : 1,
        "height" : 1,
        "file_size" : 1
      },
      "file_name" : "",
      "mime_type" : "",
      "file_size" : 1
    },
    "photo" : [ {
      "file_id" : "",
      "file_unique_id" : "",
      "width" : 1,
      "height" : 1,
      "file_size" : 1
    } ],
    "video" : {
      "file_id" : "",
      "file_unique_id" : "",
      "width" : "",
      "height" : "",
      "duration" : 1,
      "file_name" : "",
      "mime_type" : "",
      "file_size" : 1
    }
  }
}

Send Message

Name: sendMessage

Sends a message through a Telegram bot.

Properties

NameLabelTypeDescriptionRequired
chat_idChat IDSTRINGUnique identifier for the target chat or username of the target channel.true
textTextSTRINGText of the message to be sent.true
direct_messages_topic_idDirect Messages Topic IDSTRINGIdentifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat.false

Example JSON Structure

{
  "label" : "Send Message",
  "name" : "sendMessage",
  "parameters" : {
    "chat_id" : "",
    "text" : "",
    "direct_messages_topic_id" : ""
  },
  "type" : "telegram/v1/sendMessage"
}

Output

Type: OBJECT

Properties

NameTypeDescription
okBOOLEAN
Options true, false
resultOBJECT
Properties {INTEGER(message_id), INTEGER(message_thread_id), {INTEGER(topic_id), {INTEGER(id), BOOLEAN(is_bot), STRING(first_name), STRING(last_name), STRING(username)}(user)}(direct_messages_topic), {INTEGER(id), BOOLEAN(is_bot), STRING(first_name), STRING(last_name), STRING(username)}(from), {INTEGER(id), STRING(title), STRING(username), STRING(type), BOOLEAN(is_direct_messages)}(sender_chat), INTEGER(date), {INTEGER(id), STRING(title), STRING(username), STRING(type), BOOLEAN(is_direct_messages)}(chat), STRING(text), {INTEGER(topic_id), {INTEGER(id), BOOLEAN(is_bot), STRING(first_name), STRING(last_name), STRING(username)}(user)}(direct_messages_topic), {STRING(file_id), STRING(file_unique_id), {STRING(file_id), STRING(file_unique_id), INTEGER(width), INTEGER(height), INTEGER(file_size)}(thumbnail), STRING(file_name), STRING(mime_type), INTEGER(file_size)}(document), [{STRING(file_id), STRING(file_unique_id), INTEGER(width), INTEGER(height), INTEGER(file_size)}](photo), {STRING(file_id), STRING(file_unique_id), STRING(width), STRING(height), INTEGER(duration), STRING(file_name), STRING(mime_type), INTEGER(file_size)}(video)}

Output Example

{
  "ok" : false,
  "result" : {
    "message_id" : 1,
    "message_thread_id" : 1,
    "direct_messages_topic" : {
      "topic_id" : 1,
      "user" : {
        "id" : 1,
        "is_bot" : false,
        "first_name" : "",
        "last_name" : "",
        "username" : ""
      }
    },
    "from" : {
      "id" : 1,
      "is_bot" : false,
      "first_name" : "",
      "last_name" : "",
      "username" : ""
    },
    "sender_chat" : {
      "id" : 1,
      "title" : "",
      "username" : "",
      "type" : "",
      "is_direct_messages" : false
    },
    "date" : 1,
    "chat" : {
      "id" : 1,
      "title" : "",
      "username" : "",
      "type" : "",
      "is_direct_messages" : false
    },
    "text" : "",
    "document" : {
      "file_id" : "",
      "file_unique_id" : "",
      "thumbnail" : {
        "file_id" : "",
        "file_unique_id" : "",
        "width" : 1,
        "height" : 1,
        "file_size" : 1
      },
      "file_name" : "",
      "mime_type" : "",
      "file_size" : 1
    },
    "photo" : [ {
      "file_id" : "",
      "file_unique_id" : "",
      "width" : 1,
      "height" : 1,
      "file_size" : 1
    } ],
    "video" : {
      "file_id" : "",
      "file_unique_id" : "",
      "width" : "",
      "height" : "",
      "duration" : 1,
      "file_name" : "",
      "mime_type" : "",
      "file_size" : 1
    }
  }
}

Triggers

New Message

Name: newMessage

Trigger on new incoming message of any kind — text, photo, sticker, and so on.

Type: DYNAMIC_WEBHOOK

Output

Type: OBJECT

Properties

NameTypeDescription
update_idINTEGER
messageOBJECT
Properties {INTEGER(message_id), INTEGER(message_thread_id), {INTEGER(topic_id), {INTEGER(id), BOOLEAN(is_bot), STRING(first_name), STRING(last_name), STRING(username)}(user)}(direct_messages_topic), {INTEGER(id), BOOLEAN(is_bot), STRING(first_name), STRING(last_name), STRING(username)}(from), {INTEGER(id), STRING(title), STRING(username), STRING(type), BOOLEAN(is_direct_messages)}(sender_chat), INTEGER(date), {INTEGER(id), STRING(title), STRING(username), STRING(type), BOOLEAN(is_direct_messages)}(chat), STRING(text), {INTEGER(topic_id), {INTEGER(id), BOOLEAN(is_bot), STRING(first_name), STRING(last_name), STRING(username)}(user)}(direct_messages_topic), {STRING(file_id), STRING(file_unique_id), {STRING(file_id), STRING(file_unique_id), INTEGER(width), INTEGER(height), INTEGER(file_size)}(thumbnail), STRING(file_name), STRING(mime_type), INTEGER(file_size)}(document), [{STRING(file_id), STRING(file_unique_id), INTEGER(width), INTEGER(height), INTEGER(file_size)}](photo), {STRING(file_id), STRING(file_unique_id), STRING(width), STRING(height), INTEGER(duration), STRING(file_name), STRING(mime_type), INTEGER(file_size)}(video)}

JSON Example

{
  "label" : "New Message",
  "name" : "newMessage",
  "type" : "telegram/v1/newMessage"
}

How is this guide?

Last updated on

On this page