How can we help?
< All Topics
Print

How to display API responses in bot messages?

We have implemented JSON Path to address json objects and arrays.

I assume you know how to make an API Call. I will skip to the responses part.

Edit the block where you want the response to be displayed

The format of the message would be {{blockName.JSONObject}}

For example,

You have made the API Call in a Block named “APICall

The response you are getting is

{
"botId": 123,
"categoryName": "Vegetables",
"description": "Fresh green vegetables",
"isActive": true,
"isPopular": true
}

and you want to use the value of categoryName in your message then you will write {{APICall.categoryName}}.

Similarly the below should work –

  1. {{APICall.botId}}
  2. {{APICall.description}}
  3. {{APICall.isActive}}
  4. {{APICall.isPopular}}

For complex JSON arrays, you could first evaluate your JSON at https://jsonpath.com/ and then use the same address in the botbaba message blocks.

Was this article helpful?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
Previous How to make an API Call from botbaba?
Table of Contents