Connect Your Flow to External Services (via Webhook)

Introduction: Webhooks let your flow talk to external systems (CRMs, Airtable, internal databases, analytics tools) in real time. When a contact reaches a Call Webhook action, RapidPro.app sends the flow context as JSON to your endpoint and can store the JSON response so you can use it in the next steps of the flow.

Connect to a webhook (send context, use JSON response)

If you just need the essentials, follow this quick path:

  1. Collect the input (save it as a named result)
  2. Call Webhook (POST) and name the webhook result
  3. Use returned JSON in messages (test one key first)
  4. Split on returned values (always keep an Other path)
  5. Handle Failed exits with a safe fallback and/or internal alert
  6. Debug using webhook events (payload + response)

This pattern lets you integrate external systems while keeping routing predictable and debuggable.

Step-by-Step Process

1
Collect the input you want to send to the webhook

  1. In your flow, ask the contact for the value you need (example: Order number, ID, PID, etc.).
  2. Add a Wait for Response node.
  3. Save the response with a clear result name (example: order_number).

[CAPTURE: Send Message asking for an order number → Wait for Response saving result as “order_number”.]

💡
Tip: Always name your results. It makes later references and debugging much easier.

2
Add a “Call Webhook” action

  1. Add a new node after your Wait for Response.
  2. Select Call Webhook from the actions list.
  3. Set the request method to POST (recommended for sending structured data).
  4. Paste your webhook endpoint URL.
  5. Name the webhook result (example: lookup_webhook).

[CAPTURE: Call Webhook action settings showing POST selected, URL field, and a Result/Name field set to “lookup_webhook”.]

⚙️
Technical Detail: When the webhook runs, RapidPro.app sends flow context as JSON (including contact info and results collected so far). If your service returns JSON, the response is stored and can be referenced later in the flow.

⚠️
Warning: A result variable may have a size limit (commonly around 640 characters for stored result text). Keep webhook responses compact (return only what the flow needs).

3
Use the webhook response in your flow

If your external service returns JSON like:

{
  "status": "Shipped",
  "number": "CU001",
  "name": "Ben Haggerty"
}

You can reference returned keys later using the webhook variable path. Depending on your environment, you’ll typically access it via an @webhook prefix, for example:

  • @webhook.json.status
  • @webhook.json.number
  • @webhook.json.name

[CAPTURE: A Send Message node showing a message using webhook variables like “Your status is @webhook.json.status”.]

💡
Tip: Start by referencing just one returned key (like status) to validate your integration, then expand.

4
Route contacts based on returned values

  1. Add a Split by Expression node after the Call Webhook action.
  2. Evaluate the returned value (example: status).
  3. Create categories for expected outcomes (example: shipped, pending, cancelled).
  4. Send tailored messages per category.

[CAPTURE: Split by Expression evaluating @webhook.json.status with categories “shipped”, “pending”, “cancelled”, plus “Other”.]

⚠️
Warning: Always keep an Other path. If the service returns an unexpected value (or a blank response), you still need a safe fallback message.

5
Handle failures (recommended)

The Call Webhook action should include Success and Failed routing.

  1. Connect Failed to an internal alert action (email/notification/log label) if available.
  2. Optionally send the contact a friendly message (e.g., “We couldn’t check that right now—please try again later.”).

[CAPTURE: Call Webhook node showing Success → normal flow, Failed → Send Email/Notify team.]

6
View webhook events (for debugging)

  1. Go to Flows.
  2. Open the Webhooks (or “Webhook events”) area in your workspace.
  3. Review recent events in chronological order.
  4. Open an event to see:
  • The request payload sent
  • The response JSON returned (if any)

[CAPTURE: Webhook events list, then an event detail view showing request + JSON response.]

⚙️
Technical Detail: Webhook events are your best source of truth when debugging: they show exactly what your endpoint received and what it returned.

Common Issues & Quick Fixes

My webhook returns data, but my flow can’t use it

Problem: The webhook call succeeds, but variables like @webhook.json.* are empty or missing.

Fix: Confirm your endpoint returns valid JSON, and check webhook events to verify the response body. Start by referencing one simple key (like status) before building complex routing.

The webhook response gets cut off

Problem: The stored webhook result appears truncated.

Fix: Return only the fields you need in the flow (keep JSON compact). If you need large payloads, store them in your external system and return only an ID or summary fields.

Contacts fall into “Other” after the webhook

Problem: Returned values don’t match your expected categories.

Fix: Review webhook events to see the exact returned value (including capitalization). Add explicit categories for known outcomes and keep a safe Other fallback message.