Before you start
- Your API returns its responses in JSON. Both REST APIs and GraphQL APIs called over HTTP work.
- Ideally, have some API knowledge or involve your developers in the setup.
A few use cases:
- give visitors the status of their last order from their order number;
- suggest products from your catalog, for example based on their previous purchases;
- send them the link to the FAQ article that answers their question.
NB Can’t see the Workflows or API connections menu under Shopping Assistant? This feature is activated on request: contact your CSM or your main iAdvize contact.
:
.
We will query the API of a weather app.
2. Define the information to retrieve
In case of addition/modification/removal of input/output in a new version, it will be necessary to update the bot scenario accordingly
Note An input can also read a custom data of the conversation, without asking the visitor. Name it
customData.<custom_data_label>, for example customData.cust_email.
In this example the parameters are q={city} & units=metric. The input (here "city") must be between braces.
Secret values can be considered as a means of variable storage.
They are encrypted before being stored. After saving, only a few last characters (4 at most) remain visible, preceded by ****.
They are encrypted before being stored. After saving, only a few last characters (4 at most) remain visible, preceded by ****.
Tests done in the simulator are functional and have an impact on the API in the case of POST calls.
You can then use your API connection in your bots' scenario.
To find out more, read this article.
9. If the request fails
In the API connection card of the scenario, enable "Alternative in case of API request failure" to trigger another action when the request fails. The alternative is triggered in particular when:
- the API returns an error;
- the API does not respond, or takes more than 10 seconds to respond;
- the response is not in JSON, or the configured JSON path cannot be found;
- the visitor's answer does not match the expected format (text, amount, duration…), after the retries.
Tips In the alternative, add a message telling the visitor that the information is not available, then offer them another path in the scenario.
Find the cause of a failure
- Test the connection with a test value, as described in section 8.
- If the test fails, check the API Connection constraints: https URL, public address (no internal IP address, no IPv6), response in less than 10 seconds, response in JSON format.
- Call the same URL, with the same headers and body, from a tool outside iAdvize (Postman, curl…). If the call also fails or takes more than 10 seconds there, the problem comes from your API.
- If the call succeeds outside iAdvize but not in the test, compare the URL, secret values and headers entered in the connection. If the response arrives but the data is not extracted, test your JSON path on jsonpath.com.





