feat: add external notification channels (Gotify, Telegram)#75
Conversation
Add support for sending notifications to external services via the externalChannels config array in opencode-notifier.json. Channels are sent to in parallel; errors are logged to stderr and do not block other channels or local notifications. By default the array is empty so existing behaviour is unchanged. Supported channels: - gotify: POST to /message with X-Gotify-Key header - telegram: Telegram Bot API sendMessage with MarkdownV2 escaping Add src/external-notify.ts with typed channel configs, per-channel senders, and escapeMarkdownV2 helper. Update config.ts to parse and validate externalChannels entries. Update index.ts to call sendExternalNotifications from handleEvent. Add 16 unit tests covering happy path, error responses, and multi-channel scenarios.
External channel messages always interpolate {sessionTitle} regardless
of the showSessionTitle config flag. The session title lookup in
handleEventWithElapsedTime is also triggered when externalChannels is
non-empty, so the title is fetched from the API when needed.
Also add README note clarifying that suppressWhenFocused applies to
external channels as well.
Add externalNotification field to EventConfig (default true). Set it to false for events that fire too frequently or carry little actionable value for remote push channels: - user_message (fires on every user input) - client_connected - session_started - subagent_complete - user_cancelled Actionable events that interrupt the AI (permission, complete, error, question, interrupted, plan_exit) keep externalNotification: true. Users can override per-event via externalNotification in their config.
|
@mohak34 Hey guys, any release date ? |
Will be added in the next release and will come before end of this week |
|
FYI I went one step further and created a plugin that forwards questions to telegram, to be able to respond remotely: https://github.com/m0wer/opencode-telegram-question |
Excellent! Thanks for sharing! I do have one question tho, why did you choose to make it as a separate project ? |
Well, it's a different use case. And actually both projects make sense combined. I want to get sound alerts when at home (opencode-notifier) and a telegram message when away. The Telegram bot removes questions that have been answered locally, so both workflows fit nicely together. And this PR still makes sense, for users that just want external notifications. |
Add support for sending notifications to external services via the externalChannels config array in opencode-notifier.json. Channels are sent to in parallel; errors are logged to stderr and do not block other channels or local notifications. By default the array is empty so existing behaviour is unchanged.
Supported channels:
Add src/external-notify.ts with typed channel configs, per-channel senders, and escapeMarkdownV2 helper. Update config.ts to parse and validate externalChannels entries. Update index.ts to call sendExternalNotifications from handleEvent. Add 16 unit tests covering happy path, error responses, and multi-channel scenarios.