Handling Telegram Messages

Learn how to build scalable Messaging applications using the Elarian customer engagement framework.

Sending

const customer = new client.Customer({
    number: 'YOUR-CUSTOMERS-TELEGRAM-CHAT-ID',
    provider: 'telegram'
});

const resp = await customer.sendMessage(
  {
    number: 'YOUR-TELEGRAM-BOT',
    channel: 'telegram'
  },
  {
    body: {
      text: 'Hello World!',
      location: {
          longitude: 36.6997767,
          latitude: -1.2703037,
      },
      media: {
          url: 'https://some-image-site.fake/image.png',
          type: 'image',
      }
    }
  }
);

Receiving

client.on('receivedTelegram', (notification, customer, appData, callback) => {
  console.log(notification);
});