Skip to content

Connections

Custom JSON

Receive webhooks from any service that sends JSON, signed with HMAC-SHA256 or a shared secret, and map its event types to conversations, alerts or logs.

On this page

The Custom JSON preset accepts any JSON webhook. Use it for your own backend or a service without a dedicated preset. For Zapier, Make and n8n, the automation preset has a ready-made contract instead.

Setup

Any service that can POST JSON, signed with a shared secret. In Channlize, Connections → New connection → Custom JSON. The setup screen shows the connection URL (the Webhook URL) above these steps, with the secret fields and buttons at the step that needs them.

  1. Set a signing secret: generate it in Channlize (or use your own, see Signature). Requests carry the HMAC-SHA256 of the raw body in x-channlize-signature (hex, base64 or sha256=<hex>). Shared-secret mode (under Settings) accepts the secret itself instead.
  2. Send your webhooks to the URL: Channlize reads the event type from type (or event) and the delivery id from id or an Idempotency-Key header, to drop retries. Both paths, and the fields of a conversation, can be changed under Settings. The setup screen has a signed curl example.

First event: the screen shows Waiting for the first event… until one arrives. Run the curl example with your secret. Then click Done to keep the connection. Cancel deletes the draft and its URL.

Signature

Pick a long random secret (for example openssl rand -hex 32, at least 8 characters) and set it on the connection and in the sender. Two schemes:

SchemeHeader (default X-Channlize-Signature, configurable)
HMAC-SHA256 (default)HMAC-SHA256 of the raw body with the secret, hex (any case) or base64, optionally prefixed sha256=
Shared secretThe secret itself, optionally prefixed Bearer
Shell
URL=https://api.channlize.com/api/in/your-connection-token
SECRET=your-shared-secret
BODY='{"type":"lead.created","email":"ada@example.com","name":"Ada","subject":"Demo request","message":"Can we get a demo next week?"}'
SIG=$(printf '%s' "$BODY" | openssl dgst -sha256 -hmac "$SECRET" | sed 's/^.* //')

curl -X POST "$URL" \
  -H "Content-Type: application/json" \
  -H "X-Channlize-Signature: sha256=$SIG" \
  -d "$BODY"
# {"received":true,"id":"…"}
send.ts
import { createHmac } from 'node:crypto';

// connectionUrl and connectionSecret are this connection's values from its Setup tab.
export async function sendLead(connectionUrl: string, connectionSecret: string) {
  const body = JSON.stringify({ type: 'lead.created', email: 'ada@example.com', message: 'Can we get a demo next week?' });
  const signature = createHmac('sha256', connectionSecret).update(body).digest('hex');

  await fetch(connectionUrl, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json', 'X-Channlize-Signature': `sha256=${signature}` },
    body,
  });
}

Sign the exact bytes you send. Keep the URL and secret in your sender's secret store. Your own code that only needs to post to Slack can call notify() from @channlize/core with the server key and project ID instead, and needs neither.

Event type and deduplication

  • Event type: read from the path you configure, else the type field, else event, else the X-Event-Type header, else custom.event.
  • Delivery ID (for deduplication): the path you configure, else the Idempotency-Key header, else X-Webhook-Id, else the id field. Send a stable ID so retries are dropped.

Mappings

There are no default mappings: the first delivery of each event type shows up as Seen, not configured. Pick an action for it:

  • Conversation: the contact email, name, subject and message are read from configurable paths, by default email, name, subject (else "New message") and message. A payload without a valid email at that path fails with No valid email at "<path>" in the payload. Set the email field path on this connection.
  • Alert: a Slack message from a template, e.g. *New lead* {{name}} <{{email}}>\n{{message}}.
  • Log or Ignore.

Two-way replies

Not available: Custom JSON can't send replies back. Answer the customer from your own tools, using the email in the thread.