Open Tracked/Integrations/Send notifications to telegram using Google tag manager server container

Send notifications to telegram using Google tag manager server container

A Telegram bot can message you or a group when an event happens. A server container can call its API directly.

4 min read · Updated October 26, 2026

EEvent in the containerTTag calls the Bot APITelegram message
In this guide
Key takeaways
  • Create a bot with BotFather, get the chat ID, and call the Bot API's sendMessage from a server container tag.
  • Keep the bot token secret and personal data out of messages.
  • Telegram has rate limits. Use conditions so you do not send too many.

Some teams prefer Telegram to Slack for alerts, especially small teams and international ones. The Bot API is simple, and a server container can call it with one tag. This page shows the recipe. Check Telegram's Bot API documentation for current details. See Slack notifications for a similar pattern and webhook servers.

1. Create the bot

  1. In Telegram, chat with BotFather and create a new bot.
  2. Copy the bot token. It is a secret.
  3. Add the bot to your chat or group, or start a chat with it, and send a message.
  4. Find the chat ID, for example through the getUpdates method of the Bot API.
Data in, clean out

Raw events in. Clean events out.

Open Tracked collects each event on your own domain, removes the noise and sends what is left to Meta, Google Ads, TikTok.

2. The tag template

const sendHttpRequest = require("sendHttpRequest");
const JSON = require("JSON");
const getEventData = require("getEventData");

const token = data.botToken;
const chatId = data.chatId;
const text = data.message;

sendHttpRequest("https://api.telegram.org/bot" + token + "/sendMessage", (statusCode) => {
  statusCode >= 200 && statusCode < 300 ? data.gtmOnSuccess() : data.gtmOnFailure();
}, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  timeout: 3000
}, JSON.stringify({ chat_id: chatId, text: text }));

Allow https://api.telegram.org/* in the template permissions, and keep the token in a secure field.

3. What to send

  • Large orders and new leads, with order ID, total and source.
  • A daily summary rather than every event.
  • Alerts for no purchases for several hours during opening times, if your set-up can detect it.
The short version

3 things to remember

Scroll and the points stack up.

01

Create a bot with BotFather, get the chat ID, and call the Bot API's sendMessage from a server container tag.

02

Keep the bot token secret and personal data out of messages.

03

Telegram has rate limits. Use conditions so you do not send too many.

4. Limits and cautions

PointNote
Rate limitsTelegram limits how fast a bot can send messages to a chat and in total. Stay well below the limits and check the documentation
Token securityAnyone with the token can control the bot. Rotate it if it leaks
PrivacyDo not send customer data. Messages sit on Telegram's servers
ReliabilityNo automatic retry. Treat messages as a convenience

5. Test

  1. Send a test purchase in server Preview.
  2. Check the message arrives in the chat.
  3. Check the tag status and response.
  4. Send many events quickly and check that conditions prevent a flood.
0 of 5 done

A realistic example

A two-person agency wants to know when a client's checkout stops producing orders. It creates a Telegram bot, adds it to a group, and adds a tag to the client's server container that posts a message for every purchase above a set value. It also posts a message when a purchase tag returns an error. On a Sunday evening the error messages start arriving: a payment provider changed a field. The agency fixes the mapping before the client notices. The set-up took less than an hour. It worked because the messages were few, specific and tied to events that mattered, so nobody learned to ignore them.

Keep it healthy

Mute the group during quiet hours if you must, but do not remove the alerts. Review the rules every few months and remove the ones nobody acts on. If you rotate the bot token, update the secure field and send a test message the same day.

Trusted

Brands that grow on cleaner data

Stores and agencies use Open Tracked to see which ads earn the sale.

Frequently asked questions

Can a server container message Telegram?

Yes. A tag can call the Bot API's sendMessage with the bot token and chat ID.

How do I get the chat ID?

Send a message to the bot and read it through the Bot API's getUpdates method.

How do I keep the token safe?

Store it in a secure field and allow only Telegram's address in the template.

Are there limits?

Yes. Telegram limits message rates. Use conditions.

Should I include customer details?

No. Send IDs and totals only.

Do I need spreadsheets to read my results?

No. Once tracking is live, the Open Tracked analytics shows spend, revenue, ROAS and profit, and you can ask Ari, the built-in AI assistant, questions about your own numbers in plain words. Ari's allowance depends on your analytics plan.

Is Open Tracked different from Open Track or Open Space Track?

No. Open Tracked is the official name of our server-side tracking platform, and the website is opentracked.io. Many people search for it as Open Track, OpenTrack or Open Space Track. All of them lead to the same product: server-side Google Tag Manager hosting, first-party analytics and a CRM pipeline.

Fix your tracking at the source

Open Tracked hosts your server-side Tag Manager, keeps first-party cookies alive and shows what each ad is really worth.

Open Tracked
Written by

The Open Tracked team

We build Open Tracked: server-side tracking hosting, analytics and the tools around them, for stores that spend on ads. Questions about this guide, or an idea for the next one?

Write to us Read the docs

Was this article helpful?

Comments

Loading comments...

Turn better tracking into better marketing performance

Start free