Skip to content

feat: add external notification channels (Gotify, Telegram)#75

Open
m0wer wants to merge 3 commits into
mohak34:mainfrom
m0wer:main
Open

feat: add external notification channels (Gotify, Telegram)#75
m0wer wants to merge 3 commits into
mohak34:mainfrom
m0wer:main

Conversation

@m0wer

@m0wer m0wer commented May 6, 2026

Copy link
Copy Markdown

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.

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.
m0wer added 2 commits May 6, 2026 16:04
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.
@adambak033

Copy link
Copy Markdown

@mohak34 Hey guys, any release date ?

@mohak34

mohak34 commented May 18, 2026

Copy link
Copy Markdown
Owner

@mohak34 Hey guys, any release date ?

Will be added in the next release and will come before end of this week

@m0wer

m0wer commented May 25, 2026

Copy link
Copy Markdown
Author

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

@adambak033

Copy link
Copy Markdown

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 ?

@m0wer

m0wer commented May 25, 2026

Copy link
Copy Markdown
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants