Webhooks

Receive signed JSON on your own endpoint whenever something happens in Octocom, with filters and retries.

A webhook sends signed JSON to a URL you control whenever an event you chose happens: a reply from the AI agent or your team, a handoff, a closed conversation, a finished phone call. It keeps your other systems in step with support, with no code. Octocom retries failed deliveries and logs every attempt.

Common uses:

  • Forward AI agent and human agent replies into a messaging channel you run, such as your own WhatsApp provider or an in-house app
  • Notify your CRM when a conversation is handed off or closed
  • Stream conversation events into your own analytics or data warehouse
  • Alert an on-call system when a rate limit starts dropping traffic, or when automated QA flags a reply as critical

Ask Copilot or your own agent to set one up:

Ask Copilot or your AI agent

Send our CRM a webhook at https://crm.example.com/octocom/events whenever a conversation is handed off or closed, and send it a test event to check it works.

To configure one yourself, open Settings -> Automation -> Event Handlers. Create a handler, choose Webhook, paste an HTTPS endpoint, tick the events you care about, and save.

Webhook or Python event handler?

Both live under Event Handlers and react to the same events; you pick one when you create it. Use a webhook when all you need is "send this event somewhere": it is configuration, it retries on its own, and every attempt is logged. Use a Python event handler when the reaction needs logic: deciding, transforming, calling several systems, or writing back to the conversation.

Supported events

EventFires when
conversation_createdA new conversation starts
conversation_closedA conversation is closed, by an agent, the bot, or an automation
conversation_handed_offThe bot hands a conversation to a human agent
csat_sentA CSAT request email was successfully sent to the customer
conversation_ratedA CSAT score was saved, or its score or comment changed (the customer, or the API)
bot_message_sentThe bot wrote a reply. Once per message
customer_message_sentThe customer sent a message. Once per message
agent_message_sentA human agent replied from the dashboard. Once per message
campaign_recipient_unreachableA phone-campaign recipient went terminally unreachable. No conversation unless the dial reached voicemail
campaign_call_completedA connected phone-campaign call finished and its transcript is available
phone_call_completedA phone bot call ended and its transcript was saved; see args.phone_call for numbers, duration, language, workflows and the test-call flag
rate_limit_hitA rate limit was exceeded and inbound traffic is being dropped. Never tied to a conversation
bot_message_qa_completedA message QA evaluation was stored, including skipped attempts; see args.bot_qa for the decision and checks
bot_conversation_qa_completedA whole-conversation QA evaluation was stored, once per conversation; see args.bot_qa for the decision and checks
bot_qa_resultEarlier conversation QA event, kept for existing subscribers. Automatic QA emits bot_message_qa_completed and bot_conversation_qa_completed; use those for new webhooks
tag_modifiedA tag was added to or removed from a conversation; see args.tag and args.change (added or removed). Tag changes made by Octocom Python automations do not fire it, so a handler that tags cannot trigger itself
comment_handledThe bot finished handling a Facebook or Instagram comment, whether it replied, hid, deleted or handed it off
review_reply_heldA public review reply was written and is held for manual review before it auto-posts; see args.review
review_outreach_sentA reviewer outreach step happened (contact request, initial email, follow-up); see args.review_outreach
automation_execution_failedA custom action or condition provider failed after it started running
metric_alertA metric alert changed state; see args.metric_alert. Never tied to a conversation

One webhook can subscribe to any number of them. They all arrive at the same URL and carry the same payload shape, distinguished by the event field. Subscribe to tag_modified and metric_alert through Copilot or MCP (create_webhook, update_webhook). For how the campaign events fit into a campaign, see Campaign events and hooks.

Event handlers can also subscribe to a few hooks that need a return value, such as Campaign Pre-Call. Those are only available as Python event handlers, not as webhooks.

For two-way messaging, subscribe to bot_message_sent and agent_message_sent. From the customer's point of view they are the same thing, a reply; the split exists only so you can log or route them differently. Handoff is then transparent: you do not have to detect it, and nothing about your handling changes. The only difference is that message.sender becomes "agent".

Filters

Beyond the event types, a webhook can narrow what reaches it. Every filter is optional, and leaving one empty means "don't filter on this". Only playground conversations are excluded by default.

FilterWhat it does
BusinessesBy default every business in your organization. Set Scope to "Only specific businesses" to limit it, the same way custom actions are scoped. The right way to give one brand its own endpoint.
ChannelsOnly conversations whose most recent channel is one of these.
Conversation tagsFire when the conversation has any of the listed tags, or only when it has none of them.
Conversation metadataOne or more key/value conditions, all of which must match. Leave the value empty to match on the key being present at all.
Handoff stateOnly while a human owns the conversation, or only while the bot does.
Customer contact detailsOnly when the customer has a phone number, an email, or both, so you skip events you couldn't route a reply back to anyway.
Playground conversationsExcluded by default, so trying the bot internally cannot fire events at a live system.

Events that have no conversation at all (rate_limit_hit, a campaign dial that never connected, metric_alert) ignore the conversation-based filters rather than being excluded by them. A webhook watching for rate limits isn't silently blocked by an unrelated channel filter.

Filtering on your own data

Tags and metadata are the hooks for routing your own traffic. Both can be set when you create a conversation through the Conversation API:

{
  "businessSlug": "your-business",
  "messages": [{ "sender": "customer", "content": "When will it arrive?" }],
  "tags": ["whatsapp", "latam"],
  "metadata": { "source": "n8n", "orderNumber": "A-33915" }
}

A webhook filtering on tags has any of [whatsapp], or on metadata source = n8n, then receives only the traffic that integration created, with no need to inspect the payload and discard the rest on your side.

Tags can also be applied by agents and by other automations, so the same filter picks up a conversation that gets tagged later.

Payload

The body has the same shape as the context that Python event handlers receive, so code written for one reads the other.

{
  "event": "agent_message_sent",
  "sentAt": "2026-08-18T09:33:20.481Z",
  "message": {
    "id": "b71e4d90-33aa-4c58-9f21-0d5e77b1c3a2",
    "sender": "agent",
    "files": [],
    "content": "Hi Maria, I've checked with the courier...",
    "timestamp": "2026-08-18T09:33:19Z",
    "channel": "api"
  },
  "conversation": {
    "id": "9f2a41c8-6b0e-4d33-a1f9-77c2b0a4e511",
    "publicId": "pWX6WC6zr",
    "url": "https://app.octocom.ai/organization/your-org/conversation/pWX6WC6zr",
    "subject": "Delivery timing",
    "businessSlug": "your-business",
    "status": "open",
    "closedAt": null,
    "isHandedOff": true,
    "isPlayground": false,
    "initialChannel": "api",
    "latestChannel": "api",
    "inboxAddress": null,
    "tags": ["contact-form"],
    "messages": [
      {
        "id": "00000000-0000-4000-8000-000000000004",
        "sender": "customer",
        "content": "When will it arrive?",
        "timestamp": "2026-08-18T09:12:44Z",
        "channel": "api",
        "files": []
      },
      {
        "id": "b71e4d90-33aa-4c58-9f21-0d5e77b1c3a2",
        "sender": "agent",
        "content": "Hi Maria, I've checked with the courier...",
        "timestamp": "2026-08-18T09:33:19Z",
        "channel": "api",
        "files": []
      }
    ]
  },
  "business": { "name": "Your Business", "slug": "your-business" },
  "customer": {
    "id": "2d77c1b4-8e05-4b6a-9f13-6c1a0e9d4477",
    "name": "Maria Gonzalez",
    "email": null,
    "phone": "+52 55 1234 5678"
  }
}
FieldTypeNotes
eventstringWhich event fired
sentAtstringWhen Octocom built the payload (ISO 8601)
messageobjectThe one message this event is about. All you need for the happy path. null for events without a message
message.senderstringbot, agent or customer
message.filesarrayAttachments on the triggering message: id, name, contentType, url, isSafe. Empty when none.
message.iduuidStable per message. Use it to deduplicate retries
conversationobjectnull for rate_limit_hit and for campaign events where no dial connected
conversation.messagesarrayThe full thread to date, for context. Ignore it if you only need the new message
conversation.messages[].iduuidStable message ID, also available in Python transcript context. Match it to the event's message ID.
conversation.statusstringCurrent state: open, closed, or snoozed
conversation.closedAtstring or nullWhen the conversation was closed
conversation.inboxAddressstring or nullBusiness mailbox used by the latest email thread; otherwise null
conversation.messages[].filesarrayAttachments on that message: id, name, contentType, url, isSafe
conversation.assigneeobjectThe agent currently assigned, null when unassigned
conversation.messages[].agentNamestringSet on agent-sent messages, null otherwise. agentEmail sits alongside it
conversation.urlstringDeep link to the conversation in the Octocom dashboard
customer.phonestringPresent when Octocom has it, so you can route without your own lookup
argsobjectOnly on events that carry extra detail, including CSAT/rating, rate limits, QA, and campaigns

For csat_sent, args.csat.channel identifies how the request was sent. For conversation_rated, args.rating contains score (1 to 5) and the optional comment.

You can see the exact body for your own configuration, and send a real test delivery, from Payload and test delivery on the webhook's edit page.

Verifying that a request came from Octocom

Every delivery is signed with the webhook's Signing secret, shown on its edit page in the dashboard. Each request carries these headers:

X-Octocom-Signature-V2: t=1787045600,v1=<hex digest>
X-Octocom-Signature: sha256=<hex digest of the raw body>
X-Octocom-Event: agent_message_sent
X-Octocom-Delivery: 1f4b9e07-2c88-4f0a-b3d1-9a6e5c0f8d21
X-Octocom-Timestamp: 2026-08-18T09:33:20.481Z
  • X-Octocom-Signature-V2 (recommended) signs this attempt: t is when Octocom sent it, in Unix seconds, and v1 is an HMAC-SHA256 of <t>.<X-Octocom-Delivery>.<raw body>. Use it to reject stale or replayed requests.
  • X-Octocom-Signature signs the raw body only. It stays for existing receivers, but on its own it cannot tell a fresh request from a captured copy: the same body and signature are valid forever.
  • X-Octocom-Timestamp and X-Octocom-Event are not signed. Use them for logging and routing only, never for freshness checks. The signed send time is t.

To verify a request:

  1. Parse t and v1 from X-Octocom-Signature-V2.
  2. Reject the request if t is more than about 5 minutes from your clock. Every attempt, including retries and manual re-sends, is signed with its own send time, so a genuine request is always fresh.
  3. Compute the HMAC of <t>.<X-Octocom-Delivery>.<raw body> and compare it with v1 in constant time.
  4. Deduplicate on X-Octocom-Delivery. Retries and manual re-sends of a delivery reuse its ID, so a delivery you already processed can safely be acknowledged and skipped.
const crypto = require("crypto");

const TOLERANCE_SECONDS = 300;

function verify(rawBody, headers, secret) {
  const parts = Object.fromEntries(
    String(headers["x-octocom-signature-v2"] ?? "")
      .split(",")
      .map((part) => part.split("=", 2)),
  );
  const t = Number(parts.t);
  const deliveryId = String(headers["x-octocom-delivery"] ?? "");
  if (!Number.isInteger(t) || !parts.v1 || !deliveryId) return false;
  if (Math.abs(Date.now() / 1000 - t) > TOLERANCE_SECONDS) return false;

  const expected = Buffer.from(
    crypto
      .createHmac("sha256", secret)
      .update(`${t}.${deliveryId}.`, "utf8")
      .update(rawBody)
      .digest("hex"),
  );
  const received = Buffer.from(parts.v1);
  // timingSafeEqual throws on a length mismatch, so check the length first.
  return (
    expected.length === received.length &&
    crypto.timingSafeEqual(expected, received)
  );
}
import hashlib
import hmac
import time

TOLERANCE_SECONDS = 300

def verify(raw_body: bytes, headers, secret: str) -> bool:
    parts = dict(
        part.split("=", 1)
        for part in headers.get("X-Octocom-Signature-V2", "").split(",")
        if "=" in part
    )
    delivery_id = headers.get("X-Octocom-Delivery", "")
    try:
        t = int(parts["t"])
    except (KeyError, ValueError):
        return False
    if not parts.get("v1") or not delivery_id:
        return False
    if abs(time.time() - t) > TOLERANCE_SECONDS:
        return False

    signed = f"{t}.{delivery_id}.".encode() + raw_body
    expected = hmac.new(secret.encode(), signed, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, parts["v1"])

If you only check the older X-Octocom-Signature, compare sha256=<HMAC of the raw body> in constant time (check the lengths match first in Node.js), and deduplicate on X-Octocom-Delivery, keeping seen IDs for at least as long as you accept deliveries. Without t, a captured request stays valid, so move to X-Octocom-Signature-V2 when you can.

Use the raw body bytes, not a re-serialised object. Re-serialising changes key order and whitespace, and the digest will never match.

You can rotate the secret at any time from the same page. Deliveries are signed with the new secret immediately, so update the receiving end first.

Delivery, retries and ordering

  • Your endpoint must answer with a 2xx response within 10 seconds. Anything else (a non-2xx status, a connection error, or no answer within that window) counts as a failed attempt.
  • The endpoint must be a public HTTPS address. Private and internal network addresses are refused, including through a redirect, and a response body larger than 64 KB counts as a failed attempt.
  • Failed deliveries are retried with exponential backoff: after 1 minute, 5 minutes, 15 minutes, 1 hour and 6 hours. After five failed attempts the delivery is marked undelivered and no longer retried.
  • Acknowledge first, work after. Those ten seconds are the whole budget for your endpoint, so don't spend them calling another system. Return the 2xx, then do the real work; Octocom sets no time limit on what you do after responding.
  • Make your handler tolerant of duplicates. A retry can arrive after a response Octocom never received, so the same message.id may be delivered more than once.
  • Events are dispatched in order, but retries mean you should not assume they arrive in order. message.timestamp is authoritative.
  • A webhook whose deliveries keep failing is auto-disabled after 10 consecutive undelivered events, so a decommissioned endpoint doesn't accumulate retries forever. The list page shows it as Auto-disabled; fix the endpoint and switch it back on, which also resets the counter.

Every attempt (status, response code, response body and the exact payload sent) is recorded on the webhook's Deliveries tab. You can re-send any past delivery by hand from there; it replays the body as originally built rather than rebuilding it from current state.

Manage webhooks with an AI agent

Copilot and agents connected over MCP manage webhooks with these tools:

ToolWhat it does
list_webhooks, get_webhookList webhooks, or read one webhook's full configuration. The signing secret is never returned.
create_webhookCreate a webhook for chosen event types, with optional business scope and filters
update_webhookChange only the fields you pass. Turning a webhook back on also clears an auto-disable
test_webhookPOST a sample payload to the URL and report the response. It does not appear in the delivery log
list_webhook_deliveriesRecent delivery attempts with status, response code, error and payload. The first check when a receiver reports missing events
redeliver_webhook_deliveryRe-send a past delivery with its original body, for example after your endpoint was down
archive_webhook, restore_webhookStop a webhook while keeping its configuration, signing secret and delivery history, and bring it back

Two-way messaging

If you own the channel (your own WhatsApp number through your own provider, or an in-house app), you can run the whole conversation over HTTP: push customer messages in with the REST API, and receive every reply on a webhook.

  1. The customer sends you a message.
  2. Your middleware calls POST /rest/v1/conversations (first message in a thread) or POST /rest/v1/conversations/{id}/messages (every message after that). Octocom stores it and answers immediately with the conversation ID; you never wait for the AI agent.
  3. The AI agent answers. If it needs a person, it hands the conversation to your team, and an agent replies from the dashboard.
  4. Either way, Octocom POSTs the reply to your webhook, with message.sender set to bot or agent.
  5. You send it on to the customer.

Store the returned conversationId against your own thread identity. It is the key that ties the webhooks back to your customer.

Sending and receiving attachments

Both POST /rest/v1/conversations (each entry in messages) and POST /rest/v1/conversations/{id}/messages accept native attachments by URL:

{
  "content": "The product arrived damaged",
  "externalId": "infobip-message-123",
  "files": [
    {
      "url": "https://media.example.com/damage.jpg?signature=...",
      "name": "damage.jpg"
    }
  ]
}

For conversation creation, put content and files inside a messages entry alongside sender: "customer"; externalId remains at the request's top level. You may omit content for a file-only message. Every message must have text or at least one file. Historical seed messages support attachments too.

URLs must return file bytes directly over HTTP(S), without authentication headers, cookies, embedded credentials, or redirects. Temporary signed URLs work. For providers such as Infobip that require an authentication header, download the media in your middleware and re-host it at a signed URL first. Octocom downloads and stores its own copy; the source URL only needs to remain valid until the request completes. Private/internal network addresses are blocked.

Limits are 10 files across the entire request, 20 MiB per file, and 50 MiB total. Downloads have a 15-second timeout each and a 60-second overall deadline. File names are required and must not contain path separators. Content type comes from recognized PNG/JPEG/GIF/PDF signatures, otherwise the server's Content-Type (falling back to application/octet-stream). Attachments pass Octocom's file safety checks; unsafe content is rejected. Images, PDFs and Office or text documents that pass file validation are stored privately. Other files, such as audio, video or encrypted PDFs, are stored at a permanent public URL.

If a file cannot be downloaded or stored, the request returns 400 with an error identifying the failure and no new messages are written. Correct the URL or retry using the same externalId. Completed retries reuse the original message. An append with an externalId still being processed returns 409; retry it shortly.

Outbound bot_message_sent and agent_message_sent events include message.files, so you can forward precisely that message's attachments without matching against the full history. Each entry has id, name, contentType, url and isSafe; the payload's conversation.messages[].files uses the same shape. In webhooks, url is an Octocom-hosted public download URL that does not expire. For a privately stored attachment it points to a shareable copy created for the delivery.

GET /rest/v1/conversations/{id} returns the same shape at data.messages[].files, but there a privately stored attachment has a signed url that expires after one hour. Store the file id and call GET /rest/v1/files/{id} for a fresh link when you need the file.

POST /rest/v1/conversations/{id}/notes remains text-only. Include Markdown links in the note's text when you need to reference external files.

On this page