Api endpoint for background messages?
# support
c
Is there a way to send background messages to an ongoing vapi call that is started through twilio not through the sdk. The messages are triggered by something that happens outside the flow of conversation (sms to the same twilio number) but they should alter the flow of the conversation and feed context to vapi. I know this is available in the client sdk version but i want to know if it was available through the APi
Can any of the devs respond to this because it was incorrectly tagged yesterday? @User @User
v
message has been deleted
@Cowboy Yes, you can send background messages to an ongoing VAPI call that was started through Twilio. This can be done by using the VAPI REST API to send instructions to the call in progress. You would typically use the
/calls/{uuid}/talk
endpoint to send a text-to-speech message or the
/calls/{uuid}/stream
endpoint to send an audio stream to the call. When an SMS is received on the same Twilio number, you can set up a webhook in Twilio to notify your application. Your application can then use the VAPI API to alter the flow of the conversation or feed context to VAPI by sending the appropriate commands to the ongoing call. If you need to import your own phone number to use with VAPI services, you can use the dashboard or the
/phone-numbers/import
endpoint, as mentioned in the context. This will allow you to verify your number with your Twilio credentials and configure it for use with VAPI. If you need further assistance with the API or specific instructions on how to implement this, please let me know, and I'll be happy to help!
You can continue this conversation by mentioning me in the message.
Got it. Tagging @User for additional help.
c
The thing is i need to add the message to the conversation context not just make the bot say it
c
Does this only work for outbound calls ? because in the docs it says this "To initiate a call and retrieve the listenUrl and controlUrl, send a POST request to the /call endpoint." and when i tried it with a live call going on it queued the call and without one going on it started a call. Is there a way to do it for the current inbound call, not initiating an outbound one?
s
You can use it for both inbound and outbound call. This was just for example " "To initiate a call and retrieve the listenUrl and controlUrl, send a POST request to the /call endpoint.""
can you share the call id where it failed?
c
this is the call id for the call i was on when i made the post request : feadc835-6471-4ed1-a094-3867e734244a and this is the call id for the call that was created when i made the post request: 09d36cea-68ee-49d4-acf5-b343cddd71b6 and this is the request i made : url = 'https://api.vapi.ai/call/phone' headers = { 'Authorization': f'Bearer {api_key}', 'Content-Type': 'application/json', } data = { "assistantId": "df5115c1-1f46-4694-8f7f-229418893f68", "customer": { "number": customer_number }, "phoneNumberId": "9e7ce67b-1fe4-4113-bfd6-1e012d5d8a81" } response = requests.post(url, headers=headers, json=data) My use case : i want to insert a message in an already going inbound call can you see something im doing wrong?
this did get me the control url but it tried to start a call with it
even before injecting a message
c
That is the incorrect way to do it. I made a template here so people can have a "way" to do it. Note this is not for production (yet). https://github.com/HamChowderr/Listen-To-Calls
s
you cannot start the call with control url instead its used to control the call.
Your supposed to select the montiorPlan for your assistant and then when you create the call you get the both websocket urls and using it you can control the call.
4 Views