15-day Pro trial · no credit cardStart free →

API & webhooks

Webhooks

Receive STINGIM events on your server: event types, payloads, signature verification and retries.

Webhooks notify your own systems (CRM, data warehouse, Zapier, ticketing tools) when things happen in a STINGIM project.

Set up an endpoint

  1. In the console open Settings → Webhooks (requires the Integration permission).
  2. Add an endpoint: a public https:// URL, an optional description and the event types to subscribe to.
  3. Copy the signing secret (whsec_…). You can reveal it again later or rotate it — rotation takes effect immediately and the old secret stops working, so deploy the new one right away.
  4. Click Send test to deliver a webhook.test event.

Each project can have up to 20 endpoints. Subscription changes take effect within about 15 seconds.

Delivery

ItemBehaviour
RequestPOST, Content-Type: application/json, User-Agent: Stingim-Webhooks/1.0
URLPublic https:// URL on port 443 only, no credentials in the URL. Private, loopback, link-local, carrier-grade NAT and cloud-metadata addresses are rejected, and redirects are not followed.
Timeout10 seconds per attempt (5 s to connect, 5 s TLS handshake)
SuccessAny 2xx. Everything else — including 3xx and 4xx — is a failure and is retried.
RetriesUp to 8 attempts over about 24 hours: 1 min, 5 min, 30 min, 2 h, 4 h, 8 h, 9 h after the previous attempt.
Auto-disableAfter 10 consecutive deliveries that exhausted their retries, the endpoint is disabled and project admins get an in-app notification. Re-enable it in Settings → Webhooks. Test sends and manual redeliveries do not count.
SemanticsAt-least-once. Deduplicate on the envelope id.
OrderingNot guaranteed. Use created_at and resource state, not arrival order.
LogsStatus, HTTP code, error and payload of each delivery are kept for 30 days. Any delivery can be redelivered manually.

Respond quickly and do heavy work asynchronously; the response body is ignored.

Headers

HeaderExample
X-Stingim-Eventmessage.created
X-Stingim-Deliverywhd_4f0c… — the same for all automatic retries of one delivery; a manual redelivery gets a new one
X-Stingim-Signaturet=1763600000,v1=5d41402abc4b2a76b9719d911017c592…

Envelope

JSON
{
  "id": "evt_9b1d0c3e8f2a5b6c7d8e9f0a1b2c3d4e",
  "type": "message.created",
  "api_version": "2026-11-20",
  "created_at": "2026-11-20T08:30:12.345Z",
  "tenant_id": "1790000000000000001",
  "project_id": "1790000000000000002",
  "data": { }
}

IDs are strings. Timestamps are UTC (RFC 3339). Within one api_version, fields are only ever added — ignore fields you do not know.

Verify the signature

X-Stingim-Signature: t=<unix seconds>,v1=<hex>, where v1 = hex(HMAC_SHA256(secret, t + "." + raw_request_body)). The key is the full secret string including the whsec_ prefix.

  1. Use the raw body bytes; do not re-serialise parsed JSON.
  2. Compare in constant time.
  3. Reject timestamps more than 5 minutes from your clock (replay protection). t is fresh on every attempt.
import crypto from 'node:crypto';
import express from 'express';

const SECRET = process.env.STINGIM_WEBHOOK_SECRET; // whsec_...
const app = express();

app.post('/webhooks/stingim', express.raw({ type: 'application/json' }), (req, res) => {
  const header = req.get('X-Stingim-Signature') || '';
  const parts = Object.fromEntries(header.split(',').map((p) => p.trim().split('=')));
  const t = Number(parts.t);
  if (!t || Math.abs(Date.now() / 1000 - t) > 300) return res.sendStatus(400);

  const expected = crypto.createHmac('sha256', SECRET).update(`${t}.`).update(req.body).digest('hex');
  const given = Buffer.from(parts.v1 || '', 'hex');
  const want = Buffer.from(expected, 'hex');
  if (given.length !== want.length || !crypto.timingSafeEqual(given, want)) return res.sendStatus(401);

  const event = JSON.parse(req.body.toString('utf8'));
  // deduplicate on event.id, then enqueue for async processing
  res.sendStatus(204);
});

Event types

EventFires when
conversation.createdA conversation starts.
conversation.assignedA conversation is assigned or transferred to an agent.
conversation.closedA conversation is closed.
message.createdA visitor, agent or bot message is sent (system notices are not).
contact.created / contact.updatedA contact is created or its details change.
contact.tag_addedTags are added to a contact.
ticket.created / ticket.status_changedA ticket is created or changes status.
rating.submittedA visitor rates a conversation.
feedback.submittedA feedback survey (NPS / CES / CSAT) is submitted.
lead.submittedThe widget's pre-chat or offline-message form is submitted.
lead.created / lead.overdueA lead-capture form from a website invitation is completed / not followed up in time.
email.bounced / email.complainedA marketing email bounced or the recipient complained.
ai_usage.thresholdAn AI usage alert (quota, spike or circuit breaker).
webhook.testSent by Send test; cannot be subscribed to.

conversation.created / conversation.closed

JSON
{
  "conversation_id": "1861…", "contact_id": "1859…",
  "channel": { "plugin_id": "1772…", "channel_id": "1772…", "channel_code": "web" },
  "status": 3, "priority": "normal", "assigned_agent_id": "", "robot_id": "",
  "created_at": "2026-11-20T08:30:00Z"
}

status: 1 pending, 2 bot, 3 waiting to queue, 4 queued, 5 in conversation, 6 closed. priority (normal or vip) is set on created. conversation.closed always has status: 6 and adds close_reason (free text from the closing agent or the auto-close rule, may be empty) and closed_at.

conversation.assigned

JSON
{ "conversation_id": "1861…", "contact_id": "1859…", "agent_id": "1770…", "previous_agent_id": "", "reason": "assign" }

reason: assign (automatic or manual assignment, an agent accepting a conversation, or bot hand-off) or transfer.

message.created

JSON
{
  "message_id": "1862…", "conversation_id": "1861…", "contact_id": "1859…",
  "direction": "inbound", "sender_type": "visitor", "sender_id": "1859…", "sender_name": "",
  "message_type": "image", "type_code": 2, "text": "",
  "attachment": { "object_key": "tenant/…/photo.jpg", "name": "photo.jpg", "size": 48213, "mime_type": "image/jpeg" },
  "channel": { "channel_code": "web" }, "sent_at": "2026-11-20T08:31:02Z"
}

direction: inbound (visitor) or outbound (agent or bot). sender_type: visitor, agent or bot. message_type: text, image, audio, video, file, email or other (type_code 1, 2, 3, 4, 5, 33). Attachments carry metadata only — file bytes are never included.

contact.created / contact.updated

JSON
{
  "contact_id": "1859…", "name": "Ada Lovelace", "nickname": "", "email": "[email protected]",
  "phone_country": "+44", "phone": "7700900000", "country": "GB", "city": "London", "language": "en",
  "channel": { "plugin_id": "1772…", "channel_id": "1772…", "channel_code": "web" },
  "changed_fields": ["email", "phone"],
  "created_at": "2026-11-20T08:29:58Z", "updated_at": "2026-11-20T09:02:11Z"
}

changed_fields is present only on contact.updated. contact.created fires once per contact. Anonymous website visitors do not trigger it just by opening the widget: it fires when the visitor first sends a message or leaves contact details, so a widget visitor may appear in contact.updated or lead.submitted around the same time.

contact.tag_added

JSON
{ "contact_id": "1859…", "tags": [ { "id": "1801…", "name": "VIP" } ] }

ticket.created / ticket.status_changed

JSON
{
  "ticket_id": "6c1e…", "title": "Refund request", "status": "closed", "previous_status": "in_progress",
  "priority": "high", "template_id": "5a2b…", "contact_id": "1859…", "conversation_id": "1861…",
  "assignee_id": "1770…", "creator_id": "1770…", "cause": "workflow"
}

status: in_progress or closed. previous_status and cause (workflow, force_close or approval_timeout) appear only on status_changed.

rating.submitted

JSON
{
  "rating_id": "1863…", "conversation_id": "1861…", "contact_id": "1859…", "agent_id": "1770…", "robot_id": "",
  "score": 5, "max_score": 5, "label": "Very satisfied", "tags": ["fast"], "comment": "Thanks!",
  "submitted_at": "2026-11-20T08:53:00Z"
}

feedback.submitted

A customer-feedback survey response from the widget's end-of-chat form (source: widget, which also fires rating.submitted) or from a login-free feedback link sent by email, WhatsApp, a flow or a broadcast (source: link). Editing within the allowed window fires the event again with the same feedback_id and a higher revision.

JSON
{
  "feedback_id": "1871…", "source": "link", "subject_kind": "ticket",
  "conversation_id": "1861…", "ticket_id": "1868…", "contact_id": "1859…",
  "channel_code": "whatsapp", "agent_id": "1770…", "handled_by": "human",
  "nps_score": 9, "nps_category": "promoter", "ces_score": 6, "csat_score": 5, "csat_max": 5,
  "polarity": "positive", "reason_codes": ["fast_reply"], "comment": "Great help",
  "language": "en", "revision": 1, "submitted_at": "2026-11-20T09:10:00Z"
}

subject_kind: conversation, ticket or contact (broadcast surveys, which also carry campaign_id). handled_by: ai, human or none. nps_category: promoter, passive or detractor. polarity: positive, negative or neutral. Score fields are omitted when the question was not asked.

lead.submitted

JSON
{
  "lead_id": "1864…", "contact_id": "1859…", "form_type": "offline_message",
  "name": "Ada", "email": "[email protected]", "phone": "", "remark": "",
  "message": "Please call me back tomorrow",
  "custom_fields": [ { "field_id": "1805…", "value": "Enterprise" } ],
  "channel": { "plugin_id": "1772…", "channel_id": "1772…", "channel_code": "web" }
}

form_type: pre_chat or offline_message.

lead.created / lead.overdue

A visitor completed a lead-capture form opened from a website invitation (fires once, when the last step is submitted). lead.overdue fires at most once per lead that is still new after its follow-up deadline, with the same data plus overdue_at.

JSON
{
  "lead_id": "1870…", "contact_id": "1859…", "form_id": "1866…", "invite_rule_id": "1865…",
  "name": "Ada", "email": "[email protected]", "phone": "+6591234567", "whatsapp": "+6591234567",
  "company": "Acme", "custom_fields": [ { "field_id": "1805…", "value": "50-200" } ],
  "consent": true, "page_url": "https://shop.example.com/pricing",
  "score": 65, "grade": "hot", "status": "new", "owner_id": "1770…", "team_id": "",
  "follow_up_due_at": "2026-11-21T08:53:00Z", "created_at": "2026-11-20T08:53:00Z",
  "channel": { "plugin_id": "1772…", "channel_id": "1772…", "channel_code": "web" }
}

grade: hot, warm or cold, from the project's lead-scoring rules.

email.bounced / email.complained

JSON
{
  "address": "[email protected]", "kind": "hard_bounce", "source": "smtp",
  "status_code": "550", "diagnostic": "5.1.1 user unknown", "broadcast_id": "1880…",
  "contact_id": "1859…", "suppressed": true, "suppression_reason": "hard_bounce"
}

kind: hard_bounce, soft_bounce or complaint. source: smtp, dsn or arf. suppression_reason: hard_bounce, soft_bounce_repeated, complaint or manual.

ai_usage.threshold

JSON
{ "kind": "quota", "metric": "ai_answers", "threshold_percent": 80, "used": 812, "limit": 1000, "period": "2026-11" }
{ "kind": "spike", "metric": "points", "multiplier": 3, "used": 1240, "limit": 210.5, "period": "2026-11-19" }
{ "kind": "breaker", "metric": "ai_breaker", "used": 61, "limit": 60, "period": "2026-11-20T03:15" }
  • quota — an AI quota reached a threshold (default 50 / 80 / 100 %, configurable on the AI usage page). metric is ai_answers (monthly allowance), ai_tokens (partner token cap), ai_answers_daily (daily limit; only 100 % fires) or ai_answers_trial.
  • spike — AI points used today (UTC) are at least multiplier × the average of the previous 7 days; limit is that average.
  • breaker — unusually many AI calls in one minute paused AI for a few minutes; used is the calls in that minute and limit the per-minute limit.

Each threshold fires at most once per period.

webhook.test

JSON
{ "endpoint_id": "whe_…", "message": "This is a test event from STINGIM." }

Automation "HTTPS webhook" step

Automations can also call your HTTPS endpoint as a step, through a custom tool (AI & Knowledge → Custom tools). Those requests use a different signature: X-StingIM-Timestamp, X-StingIM-Delivery-ID (also sent as Idempotency-Key) and X-StingIM-Signature: sha256=<hex(HMAC-SHA256(tool secret, timestamp + "." + delivery_id + "." + raw body))>. The body is { "context": { tenant_id, project_id, process_id, thread_id, node_id, contact_id, conversation_id }, "input": { … } }. Return 2xx within 15 seconds; other 4xx responses (except 408 and 429) are not retried, everything else is retried up to 5 times.

Found a mistake? Email [email protected]