Webhooks in. API out.

Every message and event reaches your server as a signed webhook. Your CRM, agent or helpdesk answers through the API.

37 webhook events · OpenAPI 3.0

Hi Leo, your Brightline Solar quote is ready: 6.2 kW, installed in May. Want the PDF?
Delivered
L
Yes please, send it over
Sent from your CRM via iSnap API · Leo's reply goes to your webhook
How integrations work

Your tools decide. iSnap texts.

iSnap doesn't replace your CRM or your agent. It gives them a phone: events in by webhook, messages out by API.

  1. Subscribe
    POST /v1/webhooks with your HTTPS URL and the events you want. The signing secret comes back once.
  2. Verify
    Check the Standard Webhooks signature on the raw body before you parse it.
  3. Respond fast
    Return 2xx within 10 seconds, then do the work.
  4. Decide
    Your CRM or agent picks the answer, using the chat and your line metadata.
  5. Send
    POST /v1/messages with an Idempotency-Key, so a retry never sends twice.
subscribe.sh
curl -sS https://api.isnap.ai/v1/webhooks \
  -H "Authorization: Bearer $ISNAP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://hooks.your-domain.example/isnap",
    "events": ["message.*"]
  }'

From the docs: Quickstart, receive its events

Event catalog

37 events in nine families.

Subscribe to an exact type, to a family with message.*, or to everything with *.

  1. message.* (9)
    queued, scheduled, sent, delivered, read, failed, received, cancelled, fallback_triggered
  2. reaction.* (3)
    added, received, removed
  3. line.* (12)
    connected, disconnected, offline, degraded, apple_id_flagged, quota_warning, quota_exceeded, capability_changed, terminated, variant_changed, variant_scheduled, variant_unscheduled
  4. trial.* (5)
    linked, dormant, reactivated, bind_conflict, revoked
  5. pre_order.* (2)
    fulfilled, cancelled
  1. macos_session.* (2)
    rented, released
  2. binding.* (1)
    released
  3. webhook.* (1)
    test, a probe of a suspended subscription
  4. typing_indicator.* (2)
    started, stopped. iMessage lines never send these.

Some changes send no event (a reservation, an activation, a config change), so reconcile from the API. Every payload is in the event catalog.

How delivery works

At least once, in any order.

Webhooks are built for retries: dedupe on event_id, don't rely on order, and treat the API as the source of truth.

  1. Retries
    Up to 7 attempts: at once, then after 30 s, 1 min, 5 min, 30 min, 2 h and 12 h.
  2. Suspension
    After 10 deliveries in a row fail every attempt, the subscription pauses, and events in the meantime are lost.
  3. Replay and catch up
    Replay a finished delivery while its record exists, at least 72 hours, or read the events feed.
verify.py
import base64
import hashlib
import hmac
import json
import time

TOLERANCE_SECONDS = 300


def verify_delivery(raw_body: bytes, headers, secret, now=None) -> dict:
    """Verifies one delivery and returns the parsed event. Raises ValueError otherwise.

    raw_body  the request body exactly as received, as bytes
    headers   a mapping of header names in lowercase to their values
    secret    the signing secret, or a list of secrets during a rotation
    now       the current time in Unix seconds
    """
    message_id = headers.get("webhook-id")
    timestamp = headers.get("webhook-timestamp")
    signatures = headers.get("webhook-signature")
    if not message_id or not timestamp or not signatures:
        raise ValueError("missing signature header")

    now = time.time() if now is None else now
    if not (timestamp.isascii() and timestamp.isdigit()):
        raise ValueError("malformed timestamp")
    if abs(now - int(timestamp)) > TOLERANCE_SECONDS:
        raise ValueError("timestamp outside the tolerance")

    signed = f"{message_id}.{timestamp}.".encode() + raw_body
    given = [entry[3:] for entry in signatures.split(" ") if entry.startswith("v1,")]

    for candidate in [secret] if isinstance(secret, str) else secret:
        # The key is the base64 decoding of the secret without its prefix, not its hexadecimal decoding.
        key = base64.b64decode(candidate.removeprefix("whsec_"))
        expected = base64.b64encode(hmac.new(key, signed, hashlib.sha256).digest()).decode()
        # Constant-time comparison.
        if any(hmac.compare_digest(expected.encode(), signature.encode()) for signature in given):
            return json.loads(raw_body)
    raise ValueError("signature mismatch")

From the docs: Verifying signatures, with Python

SDK and HTTP

TypeScript SDK, or plain HTTP.

@isnap/sdk types every operation and handles retries. Any other language calls the same REST API with JSON.

  1. Typed errors
    AuthenticationError, RateLimitError, QuotaExceededError, ConflictError and more.
  2. Safe retries
    On connection failures, timeouts, 500 and 503, with an Idempotency-Key on every write.
  3. Webhook helpers
    verifyWebhook, plus type guards such as isMessageEvent.
  4. OpenAPI 3.0
    At api.isnap.ai/openapi.json, no key needed.
first-call.ts
import { ISnapClient } from '@isnap/sdk'

// The constructor throws when the key is missing or empty.
const client = new ISnapClient({ apiKey: process.env.ISNAP_API_KEY ?? '', maxRetries: 2 })

const { version } = await client.version()
console.log(`API version: ${version}`)

const { lines } = await client.lines.listMine()
for (const line of lines) {
  console.log(line.id, line.status)
}

From the docs: TypeScript SDK

Your CRM

Connect your CRM by webhook.

If your CRM can receive a webhook and make an HTTPS call, it can text through iSnap. Your records stay where they are.

  1. Tag lines with your ids
    Line metadata, such as a crm_account_id, rides on every event. Use ids, not personal data: anyone with the line id can read it.
  2. Thread by chat
    A chat is one line and one contact, and it follows the line. Key conversations on chat_id.
  3. Keep your own history
    iSnap deletes messages at least 72 hours after recording them. Store what you need.
  4. GoHighLevel
    The BYOP plan includes a native GoHighLevel integration. See pricing.
What a message event carriesmessage.received, from the docs
event_id
Your dedupe key; the same on retries and replays
event_type
message.received
data.message
The body, from, to, service (iMessage or SMS) and status
data.chat_id
The thread: one line and one contact
data.contact_name
When the device reports one
data.line_metadata
Your ids, set on the line
trace_id
Quote it to support

The whole payload: the event envelope.

Questions

Questions about integrations.

Building a platform on iSnap? Talk to Sales

Put a real iPhone
to work.

Start free with no credit card. Rent a line, or bring your own iPhone.