Help us shape the future of Go! Take the 2026 Go Developer Survey

webhook

command
v0.21.0-rc.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Command webhook shows how to drive an agent from an inbound messenger webhook (Slack, Telegram, Twilio, Meta, Discord) without shipping any messenger-specific code in the SDK. The transport lives in your webhook handler; the SDK supplies the durable run.

The point of the example is idempotency. Every messenger redelivers: Slack retries any event you do not acknowledge within 3s (up to three times), Twilio and Telegram and Meta all retry on timeout. A naive handler re-runs the agent on the redelivery and fires its side-effecting tools twice (a double ticket, a double charge). Here the durable journal's at-most-once semantics make a redelivered event replay the recorded run instead of re-executing it, so the side effect fires exactly once. That is the same property the chaos benchmark proves (maxFired=1), applied to an inbound channel.

Two shapes are shown, matching the two real messenger bots:

  • Stateless command bot: key the run by the provider's event id. A redelivery hits the same runID and replays. No conversation memory, simplest to reason about.
  • Conversational bot: a per-conversation Session for memory, guarded by a Step keyed by the event id so a redelivered inbound message does not open a second turn.

The model here is a stub (offline, deterministic) so the example runs with no API key; the mechanism is identical with anthropic.New / openai.New / gemini.New.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL