Where would i put the POST API in this system? I cant seem to find out

Hey, where would this post APi fit in in this system to capture both the response and the question?
No description
10 Replies
Tico | Voiceflow Assistant
In Voiceflow, you can use the POST API in the API block. Here's how you can do it: 1. Drag and drop the API block onto your canvas. 2. In the API block, select 'POST' from the dropdown menu of request types. 3. Enter the endpoint URL in the 'Endpoint' field. This is the URL that points to your API. 4. If your API requires additional information like Usernames, Passwords, or Authentication tokens, you can add them in the 'Headers, Body, and Params' section. 5. After making the API call, you will receive back a JSON object. You can save some of the information you got back onto Voiceflow using the 'Capture Response' section. Simply copy the object path or key, and paste it into the text box. Then select a variable that you would like to save to/apply to. A path always begins with "response" followed with the path you want to map. 6. You can test your API call by clicking on the 'Send/Test Request' button. If it succeeds, you will see a message saying "Success". Remember, the POST request is used to create information in your data source. So, you would use it when you want to send data from your Voiceflow project to another source.
Radiant raindrop
Radiant raindropOP2y ago
Sure thatsv helpfull, but where in the flow should it be implemented?
genetic-orange
genetic-orange2y ago
It should come after the Set AI block used to generate the response. But are you sure you want to use the same block again and again? Or are they just dummy blocks?
Radiant raindrop
Radiant raindropOP2y ago
Yeah no this is just an example But if i put it after the «set» step will it still capture the AI response? But is it a problem using the same block again and againv
genetic-orange
genetic-orange2y ago
If you use a "Set AI" step, the response from the AI is put into a variable, so you can use that variable in your API call. And using the same block again and again is not an issue by itself, especially if this is only a demo. Though I would try to avoid it and rather use a component as then you can make changes to the block in one central place.
Radiant raindrop
Radiant raindropOP2y ago
So i put that before the ai response? What’s a component?
genetic-orange
genetic-orange2y ago
A component is a collection of steps that you can reuse again: https://learn.voiceflow.com/hc/en-us/articles/9178425818893-Component What exactly do you want to do? I understood that you want to send the user's utterance AND the response of the bot to your API. To do that, you FIRST have to use the "Set AI" step to get the response. After that you place the API step and send "last_utterance" and the answer to the API endpoint.
Radiant raindrop
Radiant raindropOP2y ago
Ohh Yeah i forgot the Name, Yeah i use those in most of my projects, Thanks for answering me tho! I want to pass all of the responses and questions to a post API What variable do i put in the set Ai step?
genetic-orange
genetic-orange2y ago
The Set AI step should have a prompt to answer the user's question; therefore you need to include {last_utterance} in there. You then store the AI's answer into a variable like "last_answer" and then you can send both "last_utterance" and "last_answer" to your external endpoint.
Radiant raindrop
Radiant raindropOP2y ago
Ah ok, Thanks👍

Did you find this page helpful?