Еxpose Telegram chat.id for triggers and webhook automation

1) What is your original issue/pain point you want to solve?

We want to automate Telegram communication using Zammad triggers and webhooks (for example sending automatic replies or notifications through an external system).

2) Which are one or two concrete situations where this problem hurts the most?

  • Sending different automatic greetings depending on when a ticket is created via Telegram (for example different messages during working hours vs outside working hours). While a simple greeting exists in Zammad, it cannot be controlled by triggers.
  • Sending notifications when ticket status changes.

3) Why is it not solvable with the Zammad standard?

Triggers and webhooks cannot access Telegram metadata such as chat_id. Although Zammad stores it internally (in ticket.preferences), it is not exposed to template variables and therefore cannot be used in webhook payloads.

4) What is your expectation/what do you want to achieve?

Expose the Telegram chat_id in a way that automation can use it (for example ticket.telegram_chat_id or user.telegram_chat_id). This would allow triggers and webhooks to send messages back to the same Telegram chat via the Telegram Bot API.

Additional context

While testing webhook automation we confirmed that normal ticket fields are available in webhook payload templates, for example:

#{ticket.id}
#{ticket.title}

However, Telegram-related metadata is not accessible:

#{ticket.preferences}
#{ticket.preferences.telegram.chat_id}

This makes it impossible to obtain the Telegram chat identifier from a trigger or webhook, even though Zammad already receives and stores this value internally in order to send replies back to Telegram.

Because of this limitation, Telegram-based workflows cannot be extended with external automation. Any logic that depends on the Telegram chat context (for example sending a message through another system using the Telegram Bot API) cannot be implemented.

Typical scenarios where this becomes a limitation include:

  • sending different automated responses depending on business hours
  • integrating ticket events with external monitoring or incident management systems that notify users in Telegram
  • sending additional contextual messages to users when ticket state changes

All of these require the Telegram chat_id so that the automation can send a message back to the same conversation.

Since this identifier is already known to Zammad internally, exposing it to automation would allow much more flexible integrations without changing the core Telegram channel behavior.

Even a minimal solution — simply exposing chat_id as a template variable — would already enable many useful automation scenarios.