camelAI Documentation

Channels and voice

Channels: connect Slack, email, and HTTP webhooks to camelRun v2 agents

Create Slack, email, and HTTP channels at /v2/channels, route inbound messages to thread-keyed agents, and deliver signed outbound replies.

View as Markdown

camelRun v2 channels route inbound messages from Slack, email, or HTTP into thread-keyed durable agents and deliver agent replies back to an outbound URL via a Cloudflare Queue.

Create a channel (POST /v2/channels)

ts
const channel = await client.channels.create({
  kind: "slack", // "slack" | "email" | "http"
  name: "support-slack",
  definition: "support-triage",
  outboundUrl: "https://hooks.slack.com/services/...",
  secret: process.env.CHANNEL_WEBHOOK_SECRET!,
});

Over REST

bash
# Create a channel
curl -s -X POST "https://run.camelai.com/v2/channels" \
  -H "Authorization: Bearer $CAMELRUN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "kind": "http",
    "name": "helpdesk-bridge",
    "definition": "support-triage",
    "agentConfig": {
      "instructions": "Answer concisely in plain text."
    },
    "outboundUrl": "https://app.example.com/webhooks/agent-reply",
    "secret": "whsec_channel_secret"
  }'

# List channels
curl -s "https://run.camelai.com/v2/channels" \
  -H "Authorization: Bearer $CAMELRUN_API_KEY"

# Delete a channel
curl -s -X DELETE "https://run.camelai.com/v2/channels/$CHANNEL_ID" \
  -H "Authorization: Bearer $CAMELRUN_API_KEY"
FieldTypeDescription
kind"slack" | "email" | "http"Channel adapter type (defaults to "http")
namestringHuman-readable channel name
definitionstringOptional definition slug applied to agents created for this channel
agentConfigAgentUpsertInputOptional overrides (model, instructions, tools, mcpServers, builtins, repoId, branch) merged over the definition
outboundUrlstringOptional default URL where replies are POSTed asynchronously
secretstringOptional secret sealed at rest, used to verify inbound signatures and sign outbound replies

Inbound routing (POST /v2/channels/:id/inbound)

Send inbound events to POST https://run.camelai.com/v2/channels/<channelId>/inbound.

Authentication for inbound requests:

  • Either pass Authorization: Bearer <tenantApiKey>, OR
  • If the channel has a secret, sign the raw JSON body with HMAC-SHA256 hex in X-CamelRun-Signature (or X-Slack-Signature).

Payload extraction by channel kind

KindThread ID fields (first match)Prompt text fieldsDynamic reply URL override
slackevent.thread_ts, event.ts, threadId, "default"event.text, text, promptresponse_url
emailinReplyTo, threadId, messageId, from, "default"Optional Subject: <subject>\n\n + text / body / promptUses channel outboundUrl
httpthreadId, conversationId, "default"text, prompt, messagereplyUrl
  • Slack URL verification: When body.type === "url_verification" with a challenge string, camelRun immediately replies 200 { "challenge": "..." } before signature/agent processing.
  • Thread-keyed agents: Each thread automatically maps to an agent keyed as ch_<sanitizedChannelId>_<sanitizedThreadId>, so follow-up messages in the same thread continue the same conversation.

Sending an inbound message with the SDK

ts
const reply = await client.channels.sendInbound(channel.id, {
  threadId: "ticket-982",
  text: "How do I export my monthly invoice?",
});
console.log(reply);
// {
//   ok: true,
//   channelId: "ch_...",
//   threadId: "ticket-982",
//   agentId: "agt_...",
//   agentKey: "ch_...",
//   runId: "run_...",
//   status: "completed",
//   reply: "..."
// }

Outbound reply delivery

When outboundUrl (or response_url / replyUrl on the inbound message) is set and the run produces reply text, camelRun enqueues an async outbound HTTP POST:

  • For slack, the JSON body is { "text": replyText, "thread_ts": threadId }.
  • For email and http, the JSON body is { "channelId", "kind", "threadId", "agentId", "runId", "text", "meta" }.
  • If the channel has a secret, camelRun signs the outbound request with X-CamelRun-Signature: t=<unixSec>,v1=<hmacSha256Hex> over ${timestamp}.${payload}.