Back to All

How to store data got from a call to an external API.

Hi,

I use a JSON API interaction to send a user id to the API of an external service. The response from the API contains the name of the user. I have implemented the connection with Integromat.

I get back a response like this :

{
"user_id": "xxxxx",
"bot_id": "xxxxx",
"module_id": "xxxxx",
"message": "Hi George."
}

Where "George" is the name of the user.

Now I want to store the value "George" so that I can use it in other parts of the conversation. I suppose I should store it in some custom variable or custom attribute.

I tried things like that :

{
"user_id": "xxxxx",
"bot_id": "xxxxx",
"module_id": "xxxxx",
"message": "Hi George. [customVar varUserName=George] [setAttribute attrUserName=George]"

}

Note : The attribute "attrUserName" is an existing, already created attribute.

Unfortunately it doesn't seem to work. The variable "varUserName" or the attribute "attrUserName" do not hold the value "George" in the next interaction.

I have searched the documentation and the community questions, but I was not able to find a solution. I did find a similar question :

https://support.snatchbot.me/discuss/5b69c40498801a00030d972c

where the answer says this is possible, but it doesn't explain how.

So, am I doing something wrong? What is the way to do this?