Skip to main content

ChannelNotifier

Trait ChannelNotifier 

Source
pub trait ChannelNotifier: Send + Sync {
    // Required methods
    fn notify<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        adapter_name: &'life1 str,
        chat_id: &'life2 str,
        message: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = PunchResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn list_channels<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = PunchResult<Vec<String>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait for sending proactive notifications to external channels.

This allows the tool executor in punch-runtime to send messages to Telegram, Slack, Discord, etc. without depending on punch-channels. The API layer implements this trait and passes it as Arc<dyn ChannelNotifier> into the tool execution context.

Required Methods§

Source

fn notify<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, adapter_name: &'life1 str, chat_id: &'life2 str, message: &'life3 str, ) -> Pin<Box<dyn Future<Output = PunchResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Send a message to a specific channel.

  • adapter_name: The channel adapter name (e.g., “telegram”, “discord”, “slack”).
  • chat_id: The channel/conversation identifier on the platform.
  • message: The text message to send.
Source

fn list_channels<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = PunchResult<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List available channel adapters by name.

Implementors§