Skip to content

Catch Hook & API

Start a WhatsApp conversation from your own system, such as an order update from your store, with one HTTP request.

How Catch Hook works#

Add a Catch Hook step to a chatbot in Chat Builder. When your system calls the Agentim API with that step's name and a customer's phone number, Agentim messages the customer on WhatsApp. Any data you send becomes variables for that conversation.

  1. Your system

    POST /sendMessage

  2. Catch Hook

    order_shipped

  3. Send Message

    Hi {{#customer.name}}, order {{#order.id}} shipped

Your store sends an order event; Agentim messages the customer with the order details.

A Catch Hook step has two trigger types:

  • Start Message starts the flow at the step connected to the hook, so the customer can reply and continue.
  • Pop Up sends one standalone message (the step's text).

Not sure whether you need Catch Hook or the HTTP step? The difference is who makes the call:

Get your API key#

  1. 1

    Open Developers › API

    In the sidebar, under Developers, click API. The Keys tab opens. Only workspace owners and admins see this page.

  2. 2

    Create a key

    Click Create key and name it after the system that will use it, for example Store production. Every key can send messages, so you don't need to give it any extra access.

  3. 3

    Copy it now

    Copy the key from Copy your new key and store it in your server's secrets. You won't see it again. If you lose it, rotate the key.

  4. 4

    Send it on every request

    Put the key in the x-agentim-token header.

Use one key per system, so you can rotate or revoke it on its own. You can also limit a key's requests per minute, chatbots and expiry date. See Developers.

Integrations you set up earlier keep working with the Legacy token (the account token) shown on the same page, in the same header.

Send a message#

POST https://api.agentim.ai/sendMessage with a JSON body:

FieldRequiredDescription
node_nameYesThe name of your Catch Hook step.
channelYesmeta (WhatsApp official API), greenAPI (your number by QR), or officely (preview: sends to your own number).
customer_phoneYesThe customer's WhatsApp number in international format, digits only, for example 15551234567.
dataNoA JSON object. Its fields become variables, such as {{#order.id}}.
node_textNoText added after the step's message.
replace_textNotrue to send node_text instead of the step's message.
curl -X POST https://api.agentim.ai/sendMessage \
  -H "Content-Type: application/json" \
  -H "x-agentim-token: YOUR_API_KEY" \
  -d '{
  "node_name": "order_shipped",
  "channel": "meta",
  "customer_phone": "15551234567",
  "data": {
    "order": { "id": "3234379", "total": 84.5, "items": [{ "sku": "TSHIRT-M", "qty": 2 }] },
    "customer": { "name": "Noa" }
  }
}'

Responses#

Every response is JSON with a success field. On errors, read error_message (some authentication errors use err).

StatusMeaning
200Sent. Body: {"success": true}
400A required field is missing, for example "'node_name' Is Required..!".
401Missing token ("Token Required!") or a token that is wrong, revoked or expired ("Invalid Token!").
406The request can't be processed: node_name isn't a Catch Hook step, the channel isn't connected yet, data isn't an object, or a preview message was addressed to someone other than you.
422channel isn't one of the supported values.
426Your plan doesn't include sending to live channels. Upgrade to Pro, or use "channel": "officely" to test.
502WhatsApp or the channel provider returned an error. Retry later.
500Unexpected error. Our team is notified automatically.

A 200 means Agentim accepted the message and handed it to the channel. Delivery to the customer's phone is reported by WhatsApp, not by this response.

Test before going live#

Click the Catch Hook step on the canvas. The step panel shows everything you need:

  1. 1

    Copy the example

    Under Call this step, copy the request in your language. It already has the endpoint and this step's node_name.

  2. 2

    Send a test

    Under Send a test request, keep the officely channel, click Use my number, then Send test request. The message arrives on your own WhatsApp, on any plan. You see the response right there.

  3. 3

    See what your system sends

    On the step, click Listen for a test request, then send one real request from your system. You see exactly what arrived. Hover a line and click Copy variable to use that field in a message.

The Recent requests tab shows each call from the last 30 days, and whether it Started, Failed or was Skipped. Requests larger than 64 KB are cut to the first 64 KB.