Skip to main content
This page documents the external platform connectors and webhook integration systems within Palyra. These components bridge the Palyra daemon with third-party chat services and event providers, enabling multi-channel agent interaction and automated event ingestion.

Connector Architecture

The integration system is built upon a supervisor-adapter pattern. The ChannelPlatform in the daemon orchestrates various ConnectorAdapter implementations through a ConnectorSupervisor crates/palyra-daemon/src/channels.rs#106-110.

Data Flow: Inbound and Outbound

  1. Inbound: External events (messages, reactions) are captured by platform-specific adapters, normalized into InboundMessageEvent crates/palyra-connectors/src/lib.rs#9, and routed to the daemon’s internal state machine via the ConnectorRouter crates/palyra-connectors/src/lib.rs#6.
  2. Outbound: The daemon places messages into an outbox. The ConnectorSupervisor polls this outbox and dispatches requests to the appropriate ConnectorAdapter::send_outbound implementation crates/palyra-connectors/src/connectors/echo.rs#43-47.

Code Entity Relationship: Connectors

The following diagram illustrates how abstract connector concepts map to specific Rust entities. Connector System Mapping Sources: crates/palyra-daemon/src/channels.rs#106-132, crates/palyra-connectors/src/connectors/mod.rs#15-18, crates/palyra-connectors/src/lib.rs#2-12

Discord Integration

Discord is the primary supported platform for Palyra. It utilizes the palyra-connector-discord crate for its implementation.

Key Components

Discord Onboarding Flow

The onboarding process involves a preflight check (admin_discord_onboarding_probe_handler) followed by an application step (admin_discord_onboarding_apply_handler) crates/palyra-daemon/src/transport/http/handlers/admin/channels/connectors/discord.rs#6-40.
FunctionFilePurpose
discord_connector_idcrates/palyra-daemon/src/channels/discord.rsGenerates a canonical ID for a Discord instance.
probe_discord_bot_identitycrates/palyra-daemon/src/transport/http/handlers/admin/channels/mod.rsValidates bot token and fetches metadata.
apply_discord_onboardingcrates/palyra-daemon/src/transport/http/handlers/admin/channels/connectors/discord.rsPersists configuration and enables the connector.
Sources: crates/palyra-daemon/src/channels/discord.rs#1-21, crates/palyra-daemon/src/transport/http/handlers/admin/channels/connectors/discord.rs#6-40

Slack and Telegram Connectors

While defined in the codebase, the Slack and Telegram connectors are currently in a Deferred state crates/palyra-connectors/src/connectors/slack.rs#19, crates/palyra-connectors/src/connectors/telegram.rs#19. These adapters serve as placeholders within the default_adapters() registry crates/palyra-connectors/src/connectors/mod.rs#12-18.

Webhook Integration

The Webhook system allows Palyra to receive asynchronous events from external providers. It is managed by the WebhookRegistry crates/palyra-daemon/src/webhooks.rs#107-111.

Webhook Lifecycle

Webhooks are registered with specific providers and secret tokens stored in the Vault. Webhook Registry Structure Sources: crates/palyra-daemon/src/webhooks.rs#51-72, crates/palyra-daemon/src/webhooks.rs#107-111, crates/palyra-daemon/src/webhooks.rs#178-187

Implementation Details

CLI Management

The palyra CLI provides a webhooks command group for managing these integrations crates/palyra-cli/src/commands/channels/mod.rs#61-63.
CLI CommandDescription
palyra webhooks addRegisters a new webhook provider and secret.
palyra webhooks listLists all configured webhooks and their readiness status.
palyra webhooks testSimulates a webhook delivery to verify configuration.
Sources: crates/palyra-daemon/src/webhooks.rs#23-24, crates/palyra-daemon/src/webhooks.rs#107-118, crates/palyra-cli/src/commands/channels/mod.rs#61-63