Telegram

Let's assume that you need to automatically send notifications to the messenger whenever an issue changes its status. You may need it to see when your releases are ready for testing. To do this, create a trigger that monitors the statuses of issues of the Issue type and sends an HTTP request when the issue status changes to Need info.

Telegram supports bots for sending automated messages to group chats and individual users. To send notifications from Tracker to Telegram, create a Telegram bot and configure a trigger for sending messages from the bot using HTTP requests.

Step 1. Setting up a Telegram bot

  1. Create a new Telegram bot:

    1. In Telegram, add the @BotFather bot to your contacts and send it the /start command.

    2. Then, send the /newbot command and follow the instructions: make up a display name for the bot (for example, My Company) and an account name (for example, MyCompanyBot). The account name must end with bot.

    In response, you will get a message that the bot has been created successfully. The message will include the token: a secret code that you will need to access your bot over the API. The token follows the 1234567890:ABC123-defHIJ... format.

  2. Add the bot to the Telegram group chat where you want to send notifications from Tracker.
    To receive notifications from Tracker in private messages, start a chat with the bot.

For more information on setting up a Telegram bot, see https://core.telegram.org/bots.

Step 2. Getting the chat ID, chat topic ID, and account ID

To obtain chat IDs, chat topic IDs, and account IDs, use a specialized bot like @myidbot.

  • To find out the ID of a group chat, add the bot to this chat and send it a message saying /getgroupid. Please keep in mind that group chat IDs start with a minus sign -.

  • If a group chat in Telegram has topics, you can find the topic ID:

    1. Send a message to the topic.
    2. Right-click the message and select Copy message link.
    3. Paste the link into a text editor. The link will look like https://t.me/c/1112223334/<message_thread_id>/3, where <message_thread_id> is the chat topic ID.
  • You can send private messages using your account ID. To do this, send the bot a private message saying /getid.

Step 3. Configuring Tracker

  1. Log in to Tracker. You must have administrator privileges for the queue for which you want to configure the trigger.

  2. In the left-hand panel, click  Queues and select a queue.

  3. In the top right corner of the queue page, click  Queue settings.

  4. In the top right corner, click CreateTrigger.

  5. Enter a trigger name, such as "Notifications in Telegram".

  6. Configure trigger conditions so that the trigger is fired when the status of an issue of the Issue type changes to Need info:

    1. Add the condition: Typeis equal toIssue.

    2. Add the condition: Statusbecame equal toNeed Info.

    3. Be sure to put the AND logical operator to the left of the condition group for the trigger to fire if the conditions are met at the same time.

  7. Set the actions for the trigger:

    1. Click Add new action and choose HTTP request.

    2. Set up the request:

      • Method: POST.

      • Address: https://api.telegram.org/bot<token>/sendMessage
        Where <token> is the token you received when setting up the Telegram bot.

      • Authorization method: NoAuth.

      • Content type: application/json.

      • Request body:

        {
            "chat_id": "<chat_id>",
            "message_thread_id": "<chat_topic_id>",
            "parse_mode":"markdown",
            "text": "Information required for issue [{{issue.key}}: {{issue.summary}}](https://tracker.yandex.com//{{issue.key}})"
        }
        

        Parameter descriptions:

        • chat_id: The chat ID you received when setting up the Telegram bot.
        • message_thread_id: The chat topic ID.
        • parse_mode: Selected text parsing method. Specify "parse_mode":"markdown" to use Markdown.
        • text: Message text. To fill in the issue fields, click { } to the right of the field and choose the field name.

        To use other methods and parameters in the HTTP request, see the Telegram bot API documentation at https://core.telegram.org/bots/api.

      • Leave the headers empty.

  8. Save your trigger.

To test the trigger in action, change the status of an issue of the Issue type to Need info. The trigger will send this message to the Telegram chat: "Information required for issue TEST-123: Configure triggers".