Call your own system from a flow
Use the "Call my system" step to send customer details to your web address or look something up, such as an order status.
On this page
The Call my system step lets a flow talk to software you run yourself. It can send a customer's details to your address, or fetch a value, such as an order status, and use it in the next message.
Setting this up needs someone who can provide a web address that accepts requests, usually your developer.
Before you start
- You need a public web address that answers within 6 seconds. The builder asks for an address starting with
https://. - Addresses on a private or internal network (for example
localhostor192.168.x.x) are refused. - To look a value up, your system must answer in JSON.
Steps
- In the flow builder, click the step that should come before the call.
- In Add a step, click Call my system.
Under How to call it, choose:
- POST (send details) to send information to your system.
- GET (look something up) to fetch information.
In Your address, type the address.
You can put placeholders in it, for example
https://example.com/orders?phone={{phone}}. They are filled in and made safe for a web address.- For POST, fill in What to send (optional), or leave it empty to send the standard details described below.
To use a value from the answer, type a short name in Save a value from the reply as (optional), for example
order_status.A second field appears, Where it is in the reply (optional). Enter the key in your JSON answer. Use dots to reach inside, such as
order.status. Leave it empty if the key has the same name.- Connect the two exits: If it worked and If it failed.
- Click Save flow.
Placeholders
In the address and in the text values of what you send, you can use {{phone}}, {{name}}, {{first_name}}, {{email}}, {{last_message}} and any custom field, including answers saved by earlier Ask a question steps.
What is sent
Every request carries the header Accept: application/json. There is no setting for extra headers.
GET sends only the address.
POST with "What to send" left empty sends this JSON:
{
"contact": {
"id": 123,
"name": "Grace Rao",
"phone": "919876543210",
"email": "[email protected]",
"source": "whatsapp",
"attributes": { "city": "Denver" }
},
"conversation_id": 456,
"channel": "whatsapp",
"last_message": "Where is my order?"
}
attributes holds the contact's custom fields.
POST with your own body sends the JSON you wrote, with placeholders filled in. It must be a JSON object, with placeholders inside the quotes:
{"phone": "{{phone}}", "message": "{{last_message}}"}
The builder warns you under the field if the text is not valid JSON.
What counts as worked or failed
The step takes If it worked when your system answers with a success status (200 to 299).
It takes If it failed when:
- your system answers with any other status, including a redirect, which is not followed;
- there is no answer within 6 seconds;
- the address cannot be found, does not start with
http://orhttps://, or points to a private network; - the body you wrote is not valid JSON.
The call is made once. It is not retried. Connect If it failed to a message or a Hand to a person step so the customer is not left waiting.
Saving a value from the answer
When the call worked and your JSON answer has the key you named, its value is saved on the contact as a custom field. Later steps can use it, for example Your order is {{order_status}}.
- Only a single value can be saved (text, a number, or true/false), up to 500 characters. A list or nested object is not saved.
- The names
name,email,phone,first_nameandlast_messagecannot be used for the saved value. - If the key is missing, the step still counts as worked and nothing is saved.
See how the step is doing
Once the step has run, the builder shows a count beside each exit, and the settings panel says "So far: worked for …, failed for …". The flow's card on the Flows page shows "System call: worked … · failed …".
Common problems
Every call takes "If it failed"
Open the address in a browser from outside your office network to check it is public. Then check that it answers within 6 seconds with a 200 status and does not redirect, for example from http to https or to a login page.
"This isn’t valid JSON yet, so the step would take the “failed” exit."
Check the quotes, commas and braces in What to send. Keep placeholders inside quotes: "{{phone}}", not {{phone}}.
The next message shows an empty space where the value should be
The key was not found in your system's answer. Check Where it is in the reply against the JSON your system returns. Names are case-sensitive.
Developers who want Chatilo to notify their system about events outside a flow should read the API documentation.