Skip to content

Telegram Webhook

The Telegram Webhook component lets you listen for messages sent to your Telegram bot. Once a message arrives, the component can store it in the workflow history and provide the raw message data for further processing.

How it Works

When you add this component to your dashboard, it registers a webhook URL with Telegram. Every time someone sends a message to your bot, Telegram forwards that message to the URL. The component receives the payload, optionally saves the message to the history, and then outputs the message and a structured data object that can be used by other components.

Inputs

Input Fields

The following fields are available to configure this component. Each field may be visible in different operations:

  • Data: Use this field to quickly test the webhook component by providing a JSON payload.
  • Store Messages: If checked, the component will keep a record of each incoming message in the workflow history.

Important: Before using the component, you must create a Telegram bot API credential in Nappai’s credential section and then select that credential in the component’s Credential field.

Outputs

  • Message: The raw Telegram message object received from the webhook.
  • Data: A structured data representation of the message that can be passed to other components.

Usage Example

  1. Create a Telegram bot
    Go to BotFather and create a new bot. Copy the bot token.

  2. Add the credential
    In Nappai, navigate to Credentials, add a new Telegram bot API credential, and paste the token.

  3. Add the component
    Drag the Telegram Webhook component onto your workflow.

    • Select the credential you just created.
    • Check Store Messages if you want to keep a history.
    • (Optional) Provide a sample JSON in Data to test the component.
  4. Connect outputs
    Link the Message output to a Telegram Send Message component to echo the received message back to the user, or connect Data to a Data Store component to log the information.

  • Telegram Send Message – Send messages back to users.
  • Telegram Get Updates – Retrieve messages without a webhook.

Tips and Best Practices

  • Keep your bot token secret; never expose it in public workflows.
  • Test the webhook with a sample JSON payload before enabling it in production.
  • Use Store Messages only when you need audit trails; otherwise, leave it unchecked to reduce storage usage.

Security Considerations

The component relies on a Telegram bot token, which grants full control over the bot. Store the token in a secure credential store and restrict access to the credential to trusted users. Ensure that the webhook URL is only accessible over HTTPS to protect the data in transit.