Here's a quick guide on how to create a Telegram bot that will make posts on Telegram channel when API call is made from NetHunt.

Create a Telegram bot

  1. Search for the “@Botfather” in the Telegram

  2. Start a conversation and type “/newbot”

  3. Enter the new bot’s name (this will be a display name)

  4. Enter bot’s username (must end with “_bot”)

  5. Get bot’s API Token

  6. NOTE: Bots can’t message people first, but can message channels.

Get Channel details

  1. Create a new channel (if you don’t have it yet)

  2. Invite your bot to the Channel (search by bot’s username) and add it as an Admin

  3. Go to https://api.telegram.org/bot{{TOKEN}}/getUpdates
    Replace {{TOKEN}} with your bot’s Token

  4. Post something to the channel with the bot (so the bot “sees” that it’s added to the channel)

  5. Refresh the link above and it should have a list of all channels and conversations the bot participates in

  6. Find the channel’s ID you want to send messages via the bot to.
    NOTE: Channel’s IDs always start with a minus symbol (-).

Create a Workflow with Make an API call

  1. In the Make an API call step, in the URL field, paste the following:
    https://api.telegram.org/bot{{TOKEN}}/sendMessage

  2. In the JSON field, enter the data you want to push via the Bot.


    Syntax:
    {
    "chat_id": {{CHAT ID}},
    "text": "{{ENTER YOUR MESSAGE}}",
    "parse_mode": "HTML"
    }

    Example:

    {

    "chat_id": -1001601660289,

    "text": "<b>First name:</b> Anastasia\n<b>Last name:</b> Tatsenko\n<b>Company:</b> NetHunt CRM",

    "parse_mode": "HTML"

    }

NOTES:

1) "parse_mode": "HTML" is optional. Only need to include this line if the text in the “text” contains HTML tags like <b> to show this formatting.

2) Line breaks can be added by typing “\n”


Haven’t found the answers you’re looking for? Schedule a free assistance call with our Customer Success team.


Did this answer your question?