API Conditional
Dynamic Chat Branching

The API Conditional module queries an external API in real time — your CRM, order management system, or any REST endpoint — and branches the workflow based on the response. Check order status, verify accounts, look up subscription tiers, and route the conversation dynamically, all within the chat.

  • No credit card
  • 14-day free trial
  • UK hosted
  • Visual builder

What Is the API Conditional Module?

The API Conditional module makes an HTTP request to an external API endpoint during the chat conversation, evaluates the response, and branches the workflow based on what comes back. It's the bridge between your chat widget and the rest of your business systems — your CRM, order management platform, subscription billing service, inventory database, or any system that exposes a REST API.

Consider a common scenario: a visitor asks "Where is my order?" Without the API Conditional, an agent would need to manually look up the order number in a separate system, copy the status, and paste it into the chat. With this module, the workflow collects the order number, fires an API request to your fulfilment system, reads the response (e.g., "status": "shipped"), and displays the answer to the visitor — all in under a second, with no human involvement.

The module supports GET and POST requests with custom headers, authentication tokens, and request bodies. You can map variables captured earlier in the workflow (like an order number or email address) into the API request as query parameters or body fields. The response is then evaluated against conditions you define — status code checks, JSON field comparisons, or simple existence tests — and the workflow branches accordingly. If the API returns a match, one path fires. If it doesn't, another path handles the fallback. You can even extract specific values from the API response and store them as workflow variables for use in subsequent Message nodes.

Connect Any REST API

Send GET or POST requests to any endpoint that returns JSON. Your CRM, order system, billing platform, or custom backend — if it has an API, you can query it.

Dynamic Variable Mapping

Pass visitor-collected data (order number, email, account ID) into the API request automatically. No manual input, no agent required.

Response-Based Branching

Evaluate the API response with conditions: check a JSON field value, HTTP status code, or whether a record exists. Each outcome maps to a workflow branch.

Store Response Data

Extract values from the API response — order status, account name, subscription tier — and save them as workflow variables for use in later messages.

How the API Conditional Fits Into a Workflow

The API Conditional is typically placed after a data-collection step. You need input from the visitor — an order number, email address, account ID, or postcode — before you can query the API. The Collect Info module gathers that data, passes it to the API Conditional as a variable, and the API request fires immediately.

After the API responds, the workflow branches. A "found" branch might display the order status, account balance, or appointment details directly in the chat. A "not found" branch might ask the visitor to re-enter the data or offer to connect them to a live agent for manual lookup. An "error" branch can handle timeouts or API failures gracefully, ensuring the visitor never sees a broken experience.

Example: E-Commerce — Real-Time Order Tracking

An online retailer lets visitors check their order status directly in the chat widget, with no agent involvement.

START
Collect Info
"Enter order number"
API Conditional
GET /orders/{id}
200 OK
Message
"Shipped via Royal Mail"
404
Human Chat
Manual lookup

Step-by-Step Breakdown

  1. Collect Info: The visitor is asked for their order number. The value is saved as {{order_number}}.
  2. API Conditional: The module sends a GET request to https://api.store.com/orders/{{order_number}}. The request includes an API key in the header for authentication.
  3. 200 OK Branch: If the API returns a 200 status with order data, the workflow extracts the shipping status and carrier from the response and displays it: "Your order #12345 was shipped via Royal Mail on 15 June. Tracking: RM123456789GB."
  4. 404 Branch: If the order number isn't found, the visitor sees "We couldn't find that order number" and is connected to a live agent who can investigate manually.

Best Practices & Tips

API integrations within chat workflows are incredibly powerful but require careful setup. Follow these guidelines to ensure reliability and security.

Secure Your API Keys

Never expose API keys in client-side code. The API Conditional sends requests server-side, keeping credentials safe. Use environment variables or the built-in secrets manager.

Handle Errors Gracefully

APIs fail. Always define an error/timeout branch that gives visitors a useful fallback — a message explaining the issue and a path to a live agent who can help manually.

Set Reasonable Timeouts

Configure a timeout (e.g., 5 seconds) so visitors aren't left waiting if the external API is slow. If the timeout triggers, route to the error branch immediately.

Test with Real Data

Before going live, test your API Conditional with actual order numbers, account IDs, and edge cases (invalid input, expired records). Verify every branch works as expected.

Frequently Asked Questions

What types of API requests are supported?

The API Conditional supports GET and POST requests with custom headers, query parameters, and JSON request bodies. You can include authentication tokens, API keys, and any headers your endpoint requires.

Can I use data collected earlier in the workflow?

Yes. Any variable captured by a Collect Info, Form Field, or other input module can be injected into the API request URL, query parameters, or body using the {{variable_name}} syntax. This is how you pass order numbers, email addresses, or account IDs to your API.

What happens if the API is down or times out?

You can configure a timeout threshold and an error branch. If the API fails to respond within the timeout, or returns a server error, the workflow routes to the error branch — typically a message explaining the issue and a handoff to a live agent.

Is visitor data sent to the API securely?

Yes. All API requests are made server-side over HTTPS, so visitor data never passes through the browser. API keys and authentication tokens are stored securely and are never exposed to the client. The module is designed to be safe for transmitting sensitive data like order numbers and email addresses.

Connect Your Chat to Any System

Query APIs, display real-time data, and branch dynamically — all within your chat widget. No code, no middleware, just results.