Chatfuel

How to Integrate with JSON API

Chatfuel lets you connect to any external service — CRM, booking system, inventory, or custom backend — using the JSON API plugin.

Last updated on

Chatfuel lets you connect to any external service — CRM, booking system, inventory, or custom backend — using the JSON API plugin. Once added, it works like a regular REST API: you send requests, get responses, and use the data inside your flows.

For popular SaaS tools like Slack, Google Sheets, Notion, or HubSpot, you can skip the JSON API entirely — the AI Co-Worker can connect them for you via a secure authorization link, just ask it in chat.

Note: Setting up a JSON API integration is one of the few steps the AI Co-Worker can't complete for you — flows are built manually in the Flow Builder. The Co-Worker can take you straight to the right page: just ask.

Step 1: Add the JSON API plugin

  1. Open your flow in the Flow Builder.
  2. Add a new action block and select JSON API from the plugin list.
  3. The plugin appears as a block you can configure with a URL, method, headers, and body.

Step 2: Configure the request

Set up the JSON API block just like any REST API call:

FieldWhat to enter
URLThe full endpoint URL of the external service (e.g., https://api.example.com/bookings)
MethodGET, POST, PUT, PATCH, or DELETE
HeadersAny required headers, such as Authorization or Content-Type: application/json
BodyJSON payload for POST/PUT/PATCH requests

You can use Chatfuel user attributes inside any field by wrapping them in double curly braces: {{attribute_name}}. This lets you pass dynamic data — like the customer's name, phone number, or selected product — into your API calls.

Step 3: Map the response

After the API returns a response, you can save values from the JSON response into Chatfuel user attributes. Use JSONPath notation to extract specific fields:

  • $.status — top-level field
  • $.data.order_id — nested field
  • $.items[0].name — first item in an array

Mapped attributes are then available in subsequent blocks — text messages, conditions, or other API calls.

Common use cases

  • CRM sync — send lead data (name, phone, email) to your CRM when a customer fills out a form.
  • Order lookup — fetch order status from your backend and display it in the chat.
  • Booking confirmation — create an appointment in your scheduling system and return the confirmation to the customer.
  • Inventory check — verify product availability before recommending it.

Tips

  • Always set Content-Type: application/json in headers when sending a JSON body.
  • Test your endpoint outside Chatfuel first (e.g., with Postman or curl) to make sure it returns the expected response.
  • Keep response payloads small — only return the fields you need.
  • If the external service requires authentication, store API keys in user attributes or hardcode them in the header (never expose them to the end user).

Troubleshooting

ProblemFix
Request returns an errorDouble-check the URL, method, and headers. Test the same request in Postman.
Response data not mappingVerify the JSONPath matches the actual response structure.
Timeout or no responseThe external server may be slow or down. Add a fallback message for the user.
Authentication failsConfirm your API key or token is correct and hasn't expired.

On this page