Header background

ChatOps integration with Dynatrace and Telegram or Google Chat

If you’re in IT, you know how important it is to keep an eye on your systems and infrastructure in real-time. Many organizations now do this real-time facilitation using ChatOps to communicate quickly using a chat client that handles human-to-human and human-to-machine interactions. ChatOps integration brings communication for multiple IT operations tools into a single chat platform.

In the past, ITOps teams communicated by phone, email, and other tools, interacting manually with ticketing systems for technical support and incident management. But now, chat platforms like Telegram and Google Chat have become the preferred way to communicate. As a result, ChatOps has gained widespread popularity as more companies look for ways to improve collaboration, efficiency, and automation. The practice of ChatOps has now evolved beyond incident management to include tasks such as code deployment, monitoring, and automated incident response.

ChatOps integration between the Dynatrace observability and security platform and chat platforms like Telegram and Google Chat enables you to get updates and notifications about the performance and health of your systems right as they happen.

In this article, we’ll explain more about ChatOps and show you how to set up ChatOps integration with Dynatrace to help streamline and improve your IT operations.

What is ChatOps?

ChatOps is a DevOps practice that combines chat and operations, allowing teams to collaborate and automate tasks using a real-time chat environment. Pioneered and popularized by GitHub about 10 years ago, ChatOps has become a key accelerator for nimble DevOps environments. The practice uses a chat client, such as Telegram or Google Chat, to combine real-time communication and automation to streamline and accelerate software development and operations tasks.

Because ChatOps centers around a chat platform, teams can use plain-English commands to interact with chatbots that initiate actions with other apps and services.

ChatOps is particularly important when implementing observability for an enterprise IT landscape because it enables teams to easily share information, collaborate on issues, and take action quickly and efficiently.

For example, if a team is monitoring an application and observes an issue, they can use ChatOps to alert other team members, share problems reported by Dynatrace, and coordinate a response to the issue. This can help to reduce the time it takes to identify and resolve issues, which can improve the overall stability and reliability of the IT landscape.

How does ChatOps work?

With ChatOps, teams make the chat client the main communication channel for ongoing development and operations. Then teams integrate other tools they already use for software development and operations into the chat environment.

This ChatOps integration makes collaborative communication across tools easier and improves ticket tracking. Chatbots, such as the GitHub Hubot for developers and the Zendesk Answer Bot for customer support, provide automated incident response. In addition, chatbots also direct issues to developers for faster resolution.

Here is an overview of how ChatOps works:

  1. Team members use a chat or messaging tool, such as Slack, Telegram, or Google Chat, to communicate and collaborate in real-time.
  2. Teams integrate automated scripts into the chat or messaging tool in the form of chatbots, which can perform a wide range of tasks, such as provisioning resources, deploying code, and monitoring systems.
  3. By typing commands into the chat tool, teams can interact with these bots. For example, a team member might type “deploy to staging” to trigger a deployment script.
  4. The bot receives the command and executes the corresponding script. For example, it will deploy the code to the staging environment.
  5. The bot then sends a message back to the chat tool, providing feedback on the status of the task and any relevant information.

ChatOps integration with Dynatrace provides analysts with more context about DevOps monitoring and incident response. This helps teams to troubleshoot and resolve incidents more quickly with greater automation.

By communicating and coordinating in a central messaging tool, teams can work together more effectively and streamline their workflows.

What is a ChatBot?

A ChatBot is an automated computer program that simulates human interaction. In a ChatOps environment, ChatBots are the liaison between analysis and alerting systems, like Dynatrace, software build systems, like GitHub, workflow systems, and ticketing systems, among others.

Any service that’s part of the ChatOps integration uses a ChatBot to connect that service to the conversation. Most chat platforms, including Telegram and Google Chat, provide a mechanism for creating a bot that connects it to the platform. These platforms, in turn, manage these bots among the human users of the platform.

Good ChatOps tools: Telegram and Google Chat

Telegram and Google Chat are both messaging platforms that make good ChatOps tools because they provide a convenient and easily accessible way for teams to communicate and collaborate.

One of the main benefits of using Telegram or Google Chat as a ChatOps tool is that they’re widely used and widely available, which makes it easy for team members to access and use them. Both platforms also have robust APIs and integrations with other tools and services, which makes it easy to integrate ChatOps functionality into existing workflows and processes.

By integrating the Dynatrace observability platform with ChatOps tools, teams can realize several benefits, including the following:

  • Improve collaboration and communication among teams: ChatOps integration with Dynatrace allows for real-time, centralized communication, which can improve collaboration and coordination among teams when troubleshooting and resolving software issues.
  • Faster incident resolution: By integrating Dynatrace and ChatOps tools, teams can quickly and easily access relevant performance and error data, allowing them to quickly identify and resolve incidents.
  • Increased automation: ChatOps tools can be used to automate common tasks, such as provisioning, scaling, and deploying software. Integrating Dynatrace with these tools can provide deeper visibility into the performance of these automated processes.
  • Greater operational efficiency: By integrating Dynatrace with ChatOps tools, teams can streamline their workflows, reduce the time and effort required to troubleshoot and resolve incidents, and ultimately improve overall operational efficiency.

In the following sections, we’ll show you how to integrate Dynatrace with Telegram and Google Chat to get ChatOps running in your system.

ChatOps integration with Dynatrace and Telegram

Integrating Dynatrace into your Telegram ChatOps environment involves the following process:

  1. Create a Telegram bot for Dynatrace alerts
  2. Add the Dynatrace alerts bot to a group and get its chat_id
  3. Configure a custom notification in Dynatrace to complete the connection with Telegram

1. Create a Telegram bot for Dynatrace alerts

First, create a Telegram bot to add Dyntrace to your ChatOps integration. You can create a bot in Telegramusing the BotFather, a special Telegram bot that helps you create and manage your bots on the Telegram platform.

  1. In your Telegram app, send a message to @BotFather.
  2. In the list of commands the app returns, click /newbot.
    ChatOps integration with Telegram: BotFather command menu
  3. When prompted, give your bot a name, which must end in bot or _bot. For example, you could name your bot DynatraceAlerts_bot.
  4. When finished, BotFather generates a bot token for you to use in the next steps. Save your bot’s API access token, which will look something like 56546511:AaxxF2Xnt1-ACEMiKJ_111acc-_u12345AB.

2. Add the Dynatrace alerts bot to a group and get the chat_id

Next, add your Dynatrace alerts bot to a group and get its chat_id, which you’ll need to set up a custom notification in Dynatrace. You should be the administrator of the group you’re adding the bot to.

  1. From the Telegram group properties, invite your Dynatrace alerts bot to your Telegram group.
  2. Capture the Dynatrace alerts bot chat_id using the Telegram API utility. In a browser, go to
    https://api.telegram.org/bot<YOUR_API_TOKEN>/getUpdates or at a command line, use $ curl -X GET https://api.telegram.org/bot<YOUR_API_ACCESS_TOKEN>/getUpdates after you have sent the bot a message. Replace <YOUR_API_ACCESS_TOKEN> with your actual token. The result set will include your chat ID as id in the chat section:

    {
    "ok": true,
    "result": [{
    "update_id": 987654321,
    "message": {
    "message_id": 2,
    "from": {
    "id": 01234567,
    "first_name": "YOUR_FIRST_NAME YOUR_NICK_NAME",
    "last_name": "YOUR_LAST_NAME",
    "username": "YOUR_NICK_NAME"
    },
    "chat": {
    "id": -123456789,
    "first_name": "YOUR_FIRST_NAME YOUR_NICK_NAME",
    "last_name": "YOUR_LAST_NAME",
    "username": "YOUR_NICK_NAME",
    "type": "private"
    },
    "date": 1111111111,
    "text": "test"
    }
    }]
    }
  3. Copy and save the “chat” id, which, in the above example, is 123456789.

3. Create a custom notification in Dynatrace

Finally, create a custom notification in Dynatrace to complete the connection to the Telegram messaging platform.

  1. Log into the Dynatrace console to create a custom notification using a webhook.
  2. In the left navigation pane, go to Settings > Integration > Problem notifications and select Integration.
    Problem notifications integration
  3. In the Problem notifications page, select Add notification.
    Problem notifications screen
  4. In the Set up custom integration page, enter the following information:
    Dynatrace custom integration page to set up ChatOps with Telegram

    • In the Notification type field, Custom Integration will already be selected. Keep this selection.
    • In the Name field, enter a name for the integration. For example, Telegram integration.
    • In the Webhook URL field, enter the webhook URL using the API TOKEN and Chat ID you created in the previous step.
      https://api.telegram.org/bot<YOUR_API_TOKEN>/sendMessage?chat_id=<YOUR_CHAT_ID>
    • In the toggle section, choose the following options:
      • Accept any SSL certificate. This directs the bot to use the SSL certificate for the associated task.
      • Call webhook if new events merge into existing problems. Activate this toggle to have Dynatrace send the full payload of the original problem plus the added events to Telegram.
      • Call webhook if problem is closed. Activate this toggle to have Dynatrace send a notification to Telegram when the problem is resolved.
        Toggle details in Telegram ChatOps setup
  5. In the Custom payload field, enter the following payload:
    {
    "text": " *{State}* _{ProblemTitle}_ \n [Open Dynatrace]({ProblemURL})\n```{ProblemDetailsText}```",
    "parse_mode": "Markdown",
    "disable_web_page_preview": false
    }
  6. From the Alerting profile list, select the associated profile for this integration. It should look like the following:
    Full Telegram custom integration settings in Dynatrace
  7. To verify whether the integration is working fine with Telegram, select Send test notification, and you’ll receive the notification in your group. This allows Dynatrace to validate whether your configured endpoint is correctly handling that HTTP POST.
    Verify telegram integration by sending a test notification

Get alerted!

After the chat integration, you’ll start getting notifications from Dynatrace in your Telegram group chat.

ChatOps integration with Telegram example notifications

If you activate the option “Call webhook if problem is closed,” you’ll receive a chat message when the problem is resolved.

Example resolved notifications in Telegram

After integrating Dynatrace with Telegram, you can create a new bot that can interact with automation tools like Jenkins to trigger actions and perform tasks. This additional ChatOps integration enables you to automate certain processes using the Telegram bot to trigger actions in Jenkins. You can also run commands directly from the chat interface, improving the efficiency of your workflow. In addition, there are many other automation tools you can include in your ChatOps integration with Dynatrace and Telegram to optimize and streamline your workflows and improve the effectiveness of your IT operations.

To learn more about creating and managing bots in Telegram, refer to the official Telegram Bot documentation.

ChatOps integration with Dynatrace and Google Chat

If you use Google Chat for your ChatOps environment, use the following procedure to integrate Dynatrace into the workflow.

  1. Register the incoming Dynatrace webhook in Google Chat
  2. Create a custom notification in Dynatrace

1. Register the incoming Dynatrace webhook in Google Chat

  1. Open Google Chat in a web browser.
  2. Create a new space for your ChatOps team.
    ChatOps integration with Google Chat: Creating a new space
  3. From the drop-down menu next to the space title, select Manage webhooks.
    Manage webhooks
  4. For Name, enter a descriptive name, such as “Dynatrace alerts.” For Avatar URL, enter a URL for a PNG image to serve as the entity’s avatar and select Save.
    ChatOps integration with Google Chat: Enter the long URL of your intsance
  5. Copy the full webhook URL using the copy icon and select Save.
    Use the copy icon to copy the full webhook URL

Create a custom notification in Dynatrace

This process is similar to the Telegram integration. Follow these steps to create a custom notification in Dynatrace to complete the connection to the Google Chat messaging platform.

  1. Log into the Dynatrace console to create a custom notification.
  2. In the left navigation pane, select Settings > Integration > Problem notifications and select Integration.
    Problem notifications integration
  3. In the Problem notifications page, select Add notification.
    Add notification screen in Dynatrace

    1. In the Name field, enter a name for the integration.
    2. In the Webhook URL field, enter the webhook URL you copied, which should be something like:
      https://chat.googleapis.com/v1/spaces/SPACE_ID/messages?threadKey=ARBITRARY_STRING.
    3. In the Custom payload field, enter the following payload (you can customize it with available placeholders):
      {
      "text": " *{ProblemTitle}*\n`{ImpactedEntityNames}`\n{ProblemDetailsText}\n{ProblemURL}"
      }
  4. From the Alerting profile list, select the associated profile for this integration. It should look like this:
    Google Chat custom integration screen in Dynatrace
  5. To verify whether the integration is working fine with Google Chat, select Send test notification, and you’ll receive the notification in your Google Space.
    ChatOps integration with Dynatrace: Dynatrace alerts test run
  6. Once configured, you’ll receive notifications from Dynatrace in your group chat.
    Open:
    Sample notification of Dynatrace alerts in Google Chat
    Resolved:
    Dynatrace alerts in Google Chat

Like with Telegram, you can make your ChatOps workflows more efficient by adding other tools to your Google Chat integration with Dynatrace. For example, you can create a chat app that interacts with automation tools like Ansible. This way, you can use the chat app to trigger jobs in Ansible from the chat interface, saving you time and streamlining your processes. And it’s not just Ansible: There are plenty of other automation tools you can add to your ChatOps integration with Dynatrace and Google Chat to optimize your workflows.

To learn more about setting up and using chat apps in Google Chat, check out the official Google Chat documentation.

Need help with other integrations?

Need help integrating Dynatrace with other tools? Our team at Dynatrace ACE Services is here to assist!

We have a lot of experience working with customers to integrate Dynatrace with other software and tools. We’ll handle all the technical stuff and make sure you’re trained up and ready to go. Plus, we offer ongoing support to ensure you’re getting the most out of Dynatrace.

If you’re looking to streamline your workflows and make the most of Dynatrace, give us a shout. We’d be happy to help make the integration process as smooth as possible.

Want to see more about automating DevOps by integrating Dynatrace with ChatOps solutions? Join us for the on-demand Performance Clinic, Automate Deployment and Site Reliability with Bots, ChatOps and Dynatrace.