Practical Example: Data Lookup via Webhook (Airtable)

Introduction: If you store contact or case data in Airtable, you can use a webhook to look up information during a conversation. The flow collects an input (like a name or ID), sends it to your webhook endpoint, then uses the JSON response to personalize messages or route the contact automatically.

Run an Airtable lookup via webhook (then route automatically)

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

  1. Confirm your webhook endpoint can query Airtable and return JSON
  2. Collect the lookup input (name / PID) and save it as a result
  3. Call the webhook (POST) and store the response
  4. Use returned keys in messages (test one key first)
  5. Split on the returned status (always keep an Other fallback)
  6. Handle Failed exits cleanly (user message + internal alert)
  7. Test in the simulator and verify JSON keys in the action log

This pattern keeps your flow fast, personalized, and easy to debug when data or endpoints change.

Step-by-Step Process

1
Confirm your Airtable lookup endpoint is ready

Before building the flow, make sure you have a webhook URL that:

  • Accepts a POST request
  • Receives JSON payloads
  • Returns a JSON response with the fields your flow needs (example: pid, status, full_name)

[CAPTURE: A simple diagram or documentation snippet showing “Flow → Webhook URL → Airtable → JSON response”.]

⚠️
Warning: Do not expose Airtable API keys in your flow. Keep API keys server-side in your webhook service.

2
Collect the lookup value in your flow

  1. Add a Send Message node asking for the input you will use to search Airtable (example: “Please reply with your full name” or “Enter your PID”).
  2. Add a Wait for Response node.
  3. Save the response with a clear result name (example: lookup_input).

[CAPTURE: Send Message → Wait for Response saving “lookup_input”.]

💡
Tip: If you expect a structured value (PID, phone number, etc.), use a response rule to reduce invalid submissions.

3
Call the webhook (POST) and store the response

  1. Add a new node and choose Call Webhook.
  2. Set the request method to POST.
  3. Paste your webhook URL (the service that queries Airtable).
  4. Name the webhook result (example: airtable_lookup).
  5. Save.

[CAPTURE: Call Webhook settings showing POST, URL field, and result name “airtable_lookup”.]

⚙️
Technical Detail: RapidPro.app sends the flow context (including @contact and @results) as JSON to your webhook. If your service returns JSON, you can access it in the flow via the @webhook variable prefix.

⚠️
Warning: Webhook result storage may be limited (commonly ~640 characters for stored results). Return only the fields you actually need in the flow.

4
Use the returned JSON values in messages

Example JSON response from your webhook:

{
  "pid": "P-10293",
  "status": "active",
  "full_name": "Jane Doe"
}

You can reference values in the next nodes using the webhook JSON path, for example:

  • @webhook.json.pid
  • @webhook.json.status
  • @webhook.json.full_name

[CAPTURE: Send Message node showing “Thanks @webhook.json.full_name — your PID is @webhook.json.pid”.]

💡
Tip: Start by displaying one returned value in a message during testing (like pid) to confirm your endpoint is returning what you expect.

5
Route contacts based on webhook results

  1. Add a Split by Expression node after the webhook.
  2. Evaluate a returned key (example: @webhook.json.status).
  3. Create categories for expected outcomes (example: active, pending, not_found).
  4. Send different messages or actions per category.

[CAPTURE: Split by Expression evaluating webhook status with categories and an “Other” fallback.]

⚠️
Warning: Always keep a fallback path (like Other) to handle unexpected responses, empty JSON, or new statuses.

6
Handle webhook failures cleanly

The webhook action should provide Success and Failed exits.

  1. Connect Failed to an internal alert (email/notification/label) if available.
  2. Send the contact a helpful message (example: “We can’t retrieve your information right now. Please try again later.”).

[CAPTURE: Webhook node showing Success → normal flow, Failed → internal alert + user message.]

7
Test the Airtable lookup in the simulator

  1. Open the flow editor simulator (phone icon).
  2. Submit a test input (a name/ID that exists in Airtable).
  3. Check the simulator action log to confirm:
  • The webhook request fired
  • The JSON response returned
  1. Verify that your next steps (messages/splits) behave correctly.

[CAPTURE: Simulator view showing the action log with the webhook response JSON.]

⚙️
Technical Detail: The simulator action log is the fastest way to see whether your webhook returned valid JSON and which keys are available for reference.

Common Issues & Quick Fixes

My lookup always returns “not_found”

Problem: Valid contacts exist in Airtable, but your flow always routes to the not found path.

Fix: Confirm the webhook is searching the correct Airtable base/table/field and that you’re sending the expected input value. Use webhook events/logs to compare the incoming payload and the query your service performs.

Returned JSON keys don’t match what my flow expects

Problem: You reference @webhook.json.full_name but the response uses a different key (like name).

Fix: Standardize the response schema in your webhook service (recommended) or update the flow to reference the exact key names returned. Verify the final response in the simulator action log.

My response gets truncated

Problem: The stored webhook result is cut off and later routing becomes unreliable.

Fix: Return only the fields you need (pid/status/name). If you need more data, store it externally and return a reference ID for follow-up requests.