Integration Guide

How to Connect InstantDM with Telegram Bot (Step-by-Step Guide)

Learn how to send Telegram notifications when Instagram DM leads are captured via InstantDM. Step-by-step guide for setting up a Telegram bot for Instagram activity alerts.

Meta Business Partner
30,000+ creators
$9.99/mo flat

Telegram bots can send messages to users, groups, or channels programmatically. Connecting InstantDM to a Telegram bot gives you instant notifications on your phone when someone interacts with your Instagram automations - no email checking, no app switching.


Why Use Telegram with InstantDM?

  • Free - Telegram bots and the Bot API are completely free
  • Instant push notifications - alerts arrive on your phone immediately
  • Rich formatting - bold, italic, links, and inline buttons
  • Group support - send alerts to a team group or channel
  • No rate limits (practically) - up to 30 messages/second to different chats
  • Cross-platform - works on mobile, desktop, and web

Common Use Cases

  • Get a push notification when a new lead completes a DM flow
  • Alert your sales team in a Telegram group
  • Send daily lead summaries to a Telegram channel
  • Get notified of high-value comments in real-time
  • Monitor Instagram activity from your phone

What You'll Need

Requirement Details
InstantDM account Trendsetter, Trendsetter Pro, or any Multi plan
Telegram account Free
InstantDM API key Found at Settings → API in your InstantDM dashboard

Step 1: Create a Telegram Bot

  1. Open Telegram and search for @BotFather.
  2. Send /newbot.
  3. Choose a name (e.g., "InstantDM Alerts").
  4. Choose a username (e.g., instantdm_alerts_bot).
  5. BotFather gives you a Bot Token - copy and save it.

Step 2: Get Your Chat ID

You need the chat ID of where you want to receive messages.

For Personal Messages

  1. Start a conversation with your new bot (search for it and click Start).
  2. Send any message to the bot.
  3. Open this URL in your browser (replace YOUR_BOT_TOKEN):
    https://api.telegram.org/botYOUR_BOT_TOKEN/getUpdates
    
  4. Find the chat.id in the response - that's your personal chat ID.

For a Group

  1. Add the bot to your Telegram group.
  2. Send a message in the group.
  3. Use the getUpdates URL above to find the group's chat ID (it's a negative number).

For a Channel

  1. Add the bot as an admin to your channel.
  2. The chat ID is @your_channel_username or a negative number from getUpdates.

Step 3: Build a Webhook Relay

const express = require('express');
const app = express();
app.use(express.json());

const BOT_TOKEN = process.env.TELEGRAM_BOT_TOKEN;
const CHAT_ID = process.env.TELEGRAM_CHAT_ID;

async function sendTelegram(text, chatId = CHAT_ID) {
  const response = await fetch(
    `https://api.telegram.org/bot${BOT_TOKEN}/sendMessage`,
    {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({
        chat_id: chatId,
        text: text,
        parse_mode: 'HTML',
        disable_web_page_preview: true,
      }),
    }
  );
  return response.json();
}

app.post('/instantdm-webhook', async (req, res) => {
  const { event, timestamp, data } = req.body;
  
  let message = '';
  
  switch (event) {
    case 'flow_completed':
      message = `🎯 <b>New Instagram Lead!</b>\n\n`
        + `👤 <b>Name:</b> ${data.response_variables?.full_name || 'N/A'}\n`
        + `📧 <b>Email:</b> ${data.response_variables?.email || 'N/A'}\n`
        + `📱 <b>Phone:</b> ${data.response_variables?.phone || 'N/A'}\n`
        + `📸 <b>Instagram:</b> @${data.username}\n`
        + `🔄 <b>Flow:</b> ${data.flow_name}\n`
        + `💡 <b>Interest:</b> ${data.response_variables?.interest || 'N/A'}\n`
        + `🕐 ${new Date(timestamp).toLocaleString()}`;
      break;
      
    case 'comment':
      message = `💬 <b>New Comment</b>\n\n`
        + `👤 @${data.username}\n`
        + `📝 "${data.comment_text}"\n`
        + `🔗 <a href="${data.post_url}">View Post</a>`;
      break;
      
    case 'dm_received':
      message = `📩 <b>DM Received</b>\n\n`
        + `👤 @${data.username}\n`
        + `💬 "${data.message_text}"`;
      break;
      
    default:
      message = `📌 <b>${event}</b>\n\n👤 @${data.username}`;
  }
  
  try {
    await sendTelegram(message);
    res.status(200).json({ status: 'sent' });
  } catch (error) {
    res.status(500).json({ status: 'error', message: error.message });
  }
});

app.listen(3000);

Step 4: Configure InstantDM

  1. Deploy the relay to a public URL.
  2. In InstantDM Settings → API, paste the relay URL.
  3. Select events and save.
  4. Test with Send Test Webhook.

Via Make.com

  1. Set up the webhook scenario per the Make.com guide.
  2. Add an HTTP → Make a request module.
  3. Configure:
Setting Value
URL https://api.telegram.org/botYOUR_TOKEN/sendMessage
Method POST
Body Type JSON
  1. JSON body:
{
  "chat_id": "YOUR_CHAT_ID",
  "text": "🎯 New Instagram Lead!\n\nName: {{data.response_variables.full_name}}\nEmail: {{data.response_variables.email}}\nInstagram: @{{data.username}}",
  "parse_mode": "HTML"
}

Adding Inline Buttons

Telegram supports inline buttons for quick actions:

async function sendTelegramWithButtons(text, buttons, chatId = CHAT_ID) {
  await fetch(`https://api.telegram.org/bot${BOT_TOKEN}/sendMessage`, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      chat_id: chatId,
      text: text,
      parse_mode: 'HTML',
      reply_markup: {
        inline_keyboard: buttons,
      },
    }),
  });
}

// Usage for a lead notification with action buttons
const buttons = [
  [
    { text: '📧 Send Email', url: `mailto:${data.response_variables.email}` },
    { text: '📸 View Profile', url: `https://instagram.com/${data.username}` },
  ],
  [
    { text: '✅ Mark as Contacted', callback_data: `contacted_${data.instagram_user_id}` },
  ],
];

await sendTelegramWithButtons(message, buttons);

Troubleshooting

Issue Solution
Bot not sending messages Verify the bot token. Make sure you've started a conversation with the bot (sent /start).
"Chat not found" error The chat ID is wrong, or the bot hasn't been added to the group/channel. For groups, the bot must be a member. For channels, the bot must be an admin.
HTML formatting broken Telegram's HTML mode only supports <b>, <i>, <u>, <s>, <a>, <code>, and <pre>. Other tags will cause errors.
Messages not arriving in group Ensure the bot has permission to send messages in the group. Some groups restrict bot messaging.
Rate limited Telegram allows ~30 messages/second to different chats, but only ~20 messages/minute to the same group. Batch messages if needed.

Frequently Asked Questions

Can I send notifications to multiple people?

Yes. Send to a Telegram group (add the bot to the group) or a channel (add the bot as admin). Everyone in the group/channel sees the notification.

Is the Telegram Bot API free?

Yes, completely free with no limits on the number of bots or messages (within reasonable rate limits).

Can I receive replies from Telegram and send them as DMs?

Yes, with additional development. Set up a Telegram webhook to receive bot messages, then call the InstantDM API to send a DM. This creates a two-way bridge between Telegram and Instagram DMs.

How do I send to multiple channels based on event type?

Use different chat IDs for different events in your relay code. Map event types to channel IDs and route accordingly.


What's Next

Ready to Automate Your Instagram DMs?

Join 30,000+ creators and brands using InstantDM today.

Start Your Free Trial

No credit card required. Setup in under 15 minutes.