Example
Telegram Trigger Example
What you'll build
This integration reacts to incoming Telegram messages. When a user sends a message to your bot, the telegram:Listener receives the webhook update and routes it to the onMessage handler in your telegram:TelegramService. The handler logs the chat ID and message text.
Architecture
Prerequisites
- A Telegram bot created with @BotFather. See the Setup Guide.
- A public HTTPS URL for local development, for example using ngrok
Setting up the Telegram integration
New to WSO2 Integrator? Follow the Create a New Integration guide to set up your integration first, then return here to add the trigger.
Adding the Telegram trigger
Add a Telegram event integration and implement the listener and service as described in the Telegram event integration guide. WSO2 Integrator renders the listener and service on the design canvas, with all available handlers listed under Event Handlers.

Select telegram:TelegramService in the design canvas to open the Service Designer, which lists every pre-registered event handler bound to the telegramListener.

Handling Telegram events
Select the onMessage row to open its flow canvas, then add a Log Info step with the message text:
remote function onMessage(telegram:Message message) returns error? {
log:printInfo("Telegram message received", chatId = message.chat.id, text = message.text);
}
Running the integration
Run the integration from WSO2 Integrator, then send a message to your bot from Telegram. Telegram delivers the webhook to your listener, which invokes onMessage and logs the message. Verify the log entry in the WSO2 Integrator console output.
What's next
- Action Reference: send messages and manage chats using the
Client. - Trigger Reference: full listener configuration and service callback reference.
- Setup Guide: create a bot and configure the webhook.