Parsing response of One API to Another API call


Am using an API Call which generates the token. I need to use the token in another API Call. How to pass the Value?
Please help.

Hi @Monisha,

Welcome to the Botpress Community Forum!

I suggest you try saving the result of your call this way:

const { body } = await axios.apiCall(etc)

This way you’ll be able to inspect the body of the response and get the token.

Hope this helps!
Happy Building :robot:

Hi Maxime,

Thank you for your response.

Am able to save the response in a session variable.But when am using that variable in another API Call, it is not passing the value. Please suggest how to use the session variable in API call headers.

As of now, am not using any SDK. Am trying to do using flows.

I suggest you develop your calls in an action instead, so you can track the state of your variables using the SDK functions. You probably need to extract the token from your first response, you can’t simply pass the entire object to the next API call.

Once you get a working action, feel free to replicate that in the flows.


@Monisha If you use the API node for your first API call, you receive the API answer in temp.response that you can use for the next API in a custom code script.