stormy-gold
stormy-gold16mo ago

Unable to capture a variable

Hi guys, I'd like to capture the contact ID of the Instagram user. So I created an external request on manychat to an external webhook where I send my contact ID. (photo1) Then on voiceflow, I created an API to retrieve my contact_id and put it in the ‘user_id_manychat’ variable. (photo2) The problem is that when I display the ‘user_id_manychat’ variable nothing is displayed... Do you have an idea?
No description
No description
14 Replies
Tico | Voiceflow Assistant
To capture a variable in Voiceflow, follow these steps: 1. Create an API Block: Ensure you have an API block set up to retrieve the necessary data from your external webhook. 2. Send Request: Make sure your API request is correctly configured to send and receive the necessary data. Test the request to ensure it returns the expected JSON response. 3. Capture Response: Use the "Capture Response" section in the API block to map the data from the JSON response to a variable. The path should be correctly specified. For example, if your JSON response looks like this:
{
"contact_id": "12345"
}

{
"contact_id": "12345"
}

The path would be response.contact_id. 4. Set Variable: Ensure that the variable is properly set in the Capture Response section. Double-check that there are no typos or incorrect paths. 5. Display Variable: When displaying the variable, ensure that you are using the correct syntax to reference the variable in your Voiceflow project. Here is a step-by-step example: 1. API Block Configuration: - Method: GET (or POST, depending on your webhook) - URL: Your webhook URL - Headers: Add any necessary headers (e.g., Authorization) 2. Capture Response: - Path: response.contact_id - Variable: contact_id 3. Testing: - Test the API request to ensure it returns the correct JSON response. - Verify that the variable is being set correctly. If you have followed these steps and the variable is still not displaying, double-check the following: - Ensure the API request is successful and returns the expected data. - Verify that the JSON path in the Capture Response section is correct. - Confirm that the variable is being used correctly in your Voiceflow project. For more detailed guidance, you can refer to the Voiceflow API documentation.
W. Williams (SFT)
Are you using the API?
stormy-gold
stormy-goldOP16mo ago
Hi thx for your response Look my API bloc on VF
stormy-gold
stormy-goldOP16mo ago
No description
stormy-gold
stormy-goldOP16mo ago
No description
stormy-gold
stormy-goldOP16mo ago
Above you have the manychat request on the screen And when I try the API bloc I've "API call successfully triggered" But in my user_id_manychat I've nothing
stormy-gold
stormy-goldOP16mo ago
No description
stormy-gold
stormy-goldOP16mo ago
I don't understand...
W. Williams (SFT)
Just use a Text step and output {user_id}
stormy-gold
stormy-goldOP16mo ago
No description
stormy-gold
stormy-goldOP16mo ago
Like this ? Because it doesn’t work…
W. Williams (SFT)
user_id is set already. It is set by your Instagram connection already. You do not need to do an API call.
stormy-gold
stormy-goldOP16mo ago
But if I want to add a tag from voiceflow to manychat, it asks me for the subscriber id. I just have to put the user_id? I don't quite understand what you mean.
W. Williams (SFT)
DM me and I'll be happy to help

Did you find this page helpful?