CrabTalkCrabTalk

Build a Gateway

Create a custom gateway — connect any messaging platform to CrabTalk agents.

A gateway connects an external platform to CrabTalk. Telegram is a gateway. Discord, Slack, Matrix, a custom web chat — anything that receives messages can be one.

How gateways work

A gateway is an independent binary that:

  1. Listens for messages from an external platform
  2. Connects to the CrabTalk daemon via Unix domain socket
  3. Forwards messages to an agent
  4. Streams responses back to the platform

The daemon doesn't manage the gateway process. It runs as a system service (launchd on macOS, systemd on Linux), just like the Telegram gateway.

1. Start from the template

Clone the crabtalk-client template:

gh repo create crabtalk-discord --template crabtalk/crabtalk-client
cd crabtalk-discord

The template gives you a working client that connects to the daemon and handles the message loop.

2. Implement the platform integration

Add your platform's SDK or API client. The template handles the daemon connection — you add the code to receive messages from your platform and send responses back.

3. Name and install

Name your binary crabtalk-<name>:

cargo build --release
cp target/release/crabtalk-discord ~/.cargo/bin/

It becomes available as crabtalk discord. The binary handles its own service installation — crabtalk discord start installs a system service and starts it.

4. Test

crabtalk discord start
crabtalk ls              # verify it's running

Send a message on your platform. The gateway forwards it to the daemon, the agent responds, and the response appears on the platform.

What's next

On this page