Background messaging not really background
# support
s
Exactly same as this https://discord.com/channels/1211482211119796234/1280702984191217724 But as stated in this comment on that thread https://discord.com/channels/1211482211119796234/1280702984191217724/1281670465592627270, this is a known issue and a fix is expected. Is this not patched yet?
@Vapi
v
@Samesh I'm here to help! If you're referring to a known issue with VAPI, I would need to check the latest updates or patch notes to provide you with accurate information. Unfortunately, I don't have access to external links like Discord, but I can certainly help you with any questions or issues you might have with VAPI. If you're experiencing a problem, could you please describe it in detail? If there's a fix available, I'll guide you through it or provide you with the necessary steps to resolve the issue.
@Samesh I'm glad you reached out for an update. As of my last update in April 2023, I don't have the latest patch notes or bug fix updates. However, I can certainly check for you if you provide me with the specific details of the issue. If it's a known issue, there might be a workaround or a patch that has been released since my last update. Could you please provide me with the details or symptoms of the issue you're experiencing? This will help me assist you better.
You can continue this conversation by mentioning me in the message.
Got it. Tagging @User for additional help.
s
@Shubham Bajaj can i have an update on this issue pls? thanks
s
can you share the recent call id.
s
@Shubham Bajaj this is the call id
919ba550-efd8-4ad1-ab66-afbfd08a0864
You can check the call recording / transcripts, the assistant visibly stops (pause of 1 sec) after everytime I try sending a background message (role: system).
can you use call control?
@Samesh
this will fix your issue
s
I don't understand how this will fix my issue. a) The first step of the call control api is to send a POST request to
/call
which requires a phone number? But I am only want to use the web call (no phone calls) b) Is this step required? Because I am using the vapi npm library(web SDK) and I start the call from that so I am not sure how I would continue the call (through the SDK) even after the POST request to
/call
endpoint. So, I want to understand how can I retrieve the
controlUrl
of a call if I start it through the web SDK (
.start()
method)? Does that method return this data? c) I understand that you probably imply me to use the call control API as given in this example (https://docs.vapi.ai/calls/call-features#example-injecting-a-message). Is the expected format for the query to inject background similar like so:
Copy code
curl -X POST 'https://aws-us-west-2-production1-phone-call-websocket.vapi.ai/7420f27a-30fd-4f49-a995-5549ae7cc00d/control' 
-H 'content-type: application/json' 
--data-raw '{
  type: "add-message",
  message: {
    role: "system",
    content: "The user has pressed the button, say peanuts",
  },
}'
? d) And if this format is correct, how is call control API different from the web SDK's
.send()
method https://docs.vapi.ai/assistants/background-messages#scenario-overview used in background messaging ? Does that mean that the background messaging is not currently working right now?
@Shubham Bajaj ^
I am online now and this is a very important issue for my company. Would help if we can solve it ASAP. Thanks!
s
This is a temp solution for now not the exact fix.
I know the guide is for the phone call but if you could log the vapi.start()
value it provides you the control url and using that you can fix your issue for now.
s
Cool, appreciate the quick reply. Let me test this and reply back here.
Hey @Sahil, I just ran the below CURL command on a live call I started through the SDK (and used the control url i got from
.start()
method) but I got the response as
job not found
.
Copy code
curl -X POST "https://aws-us-west-2-production2-phone-call-websocket.vapi.ai/ced7d70b-804b-4e34-9f7a-4842fc84ef10/control" \
-H "content-type: application/json" \
--data-raw "{\"type\": \"say\", \"message\": \"Welcome to Vapi, this message was injected during the call.\"}"
Am I missing something?
s
This will only work when the call is active.
try to do it via postman
s
The call was indeed active when I did it
Let me try on postman
@Sahil
s
Let me check with the team once.
s
Yes pls
s
will inform you by tomorrow
s
sounds good
Hey @Sahil, any update on this?
s
Yes, talked to nikhil he told me that it is working properly.
Can you send me stackblitz link?
to reproduce this issue?
s
Cool, let me try this again and send you the stackblitz link
Hey @Sahil , I am attaching a simplified version of my setup here https://stackblitz.com/edit/stackblitz-starters-kans4u?file=index.html (let me know if I can do anything else to help you debug this) The main thing to consider is: a) I get the vapi instance through
window.vapiSDK.run
b) Then get the controlURL through
Copy code
(await vapiInstance.start(assistantId))["monitor"]
["controlUrl"];
To test this on the link: a) Click on "Start Vapi" button. It starts a web call and logs the control URL of that call on the page b) Copy the control url and send a request using the live call control feature (while the call is active on the web page). You will get error as "job not found" Example request:
Copy code
curl -X POST 'https://aws-us-west-2-production1-phone-call-websocket.vapi.ai/7420f27a-30fd-4f49-a995-5549ae7cc00d/control' 
-H 'content-type: application/json' 
--data-raw '{
  "type": "say",
  "message": "Welcome to Vapi, this message was injected during the call."
}'
Is there something wrong with my curl request? Because I have tried using postman and I am getting the same error.'
s
This uses web snippet
I need the code for web sdk and using the background message
z
@Sahil @Samesh I am also experiencing the job not found 404 error during the call for curl post request: curl -X POST 'https://aws-us-west-2-production1-phone-call-websocket.vapi.ai/7420f27a-30fd-4f49-a995-5549ae7cc00d/control' -H 'content-type: application/json' --data-raw '{ "type": "say", "message": "Welcome to Vapi, this message was injected during the call." }'
s
But didn't you just suggest me to use the live control url as a temporary solution because the
.send()
isn't working?
^here @Sahil
And as mentioned in this support ticket https://discord.com/channels/1211482211119796234/1280702984191217724, the background messaging through
.send()
is buggy and it is not fixed right?
z
.send() actually works, for websdk but it will only be background messaging. @Samesh Did u experience curl post aws/*****/control url and received 404 job not found problem?
s
@ZigzagToYou#0504 a) Does
.send()
actually work as intended tho, i.e, sending background messages? Because if I send a message with
type
as
system
or
assistant
, that interrupts my assistant every time. The ideal way I assume this should work is that it just adds whatever I send to the context of the conversation without the assistant even stopping the flow of the whatever it was speaking. Currently, it always stops the assistant for atleast 1 sec. b) Yes. I am experiencing 404 job not found problem as you have stated. @Sahil can you pls check this again? Looks like live call control isn't working as stated in the docs. Can you pls check with the team and give a complete solution? Thanks!
s
I confirmed with nikhil about this whether it is working or not. He mentioned that it is working correctly
So, I will need stackblitz example which I can share with the team
s
Okay. Sharing the stackblitz example in 15
Is the live control URL working correctly? Looks like @ZigzagToYou#0504 also is getting the same error as me
z
@Samesh I am also having problem with the vapi.send(), My speech did glitch a lot during the call and it is sending multiple background message during the call, but i guessed the problem might comes from the speech update side. Also I am wondering if the listen url is working as desired since control isn't working for me during the call? "listenUrl": "wss://aws-us-west-2-production1-phone-call-websocket.vapi.ai/7420f27a-30fd-4f49-a995-5549ae7cc00d/transport" from live call control. I was trying to send the live audio to my server. https://cdn.discordapp.com/attachments/1287280603485442111/1288770193149001728/Screenshot_2024-09-25_at_3.23.13_PM.png?ex=66f66446&is=66f512c6&hm=168ca4d5291d8b283906282a3733177c82b648543716d973add2b30d0d35217d& https://cdn.discordapp.com/attachments/1287280603485442111/1288770193472098314/Screenshot_2024-09-26_at_12.45.53_AM.png?ex=66f66446&is=66f512c6&hm=92e9b080caaf62c2a5bd62970cde40da975bab57d335143d38b409a7ace199c8&
@Sahil
s
Here's the stackblitz URL @Sahil. https://stackblitz.com/edit/stackblitz-starters-kans4u?file=index.html To test it: a) Start the call with "Start vapi" button b) Press the "Log action" button to send background messages through the
.send()
API. You will observe that the assistant ALWAYS stutters & then restarts what it was already going to say when you send that background update (the update is successful because you can check that in the transcripts). Lmk how I can help you better because I want to get this issue resolved ASAP, it's already taken too long for my company. TIA
z
@Samesh May i use this example too?
s
Sure
z
@Samesh does the controlurl post request actually work?
s
No, it doesn't. I am getting
job not found
error. That's just there to help @Sahil and team debug
z
Got it Thanks!
s
vapiInstance.send({ type: 'say', content: 'The user has pressed the button, say peanuts' });
use this and it will work
@Samesh
@ZigzagToYou#0504
z
@Sahil What about the Call listen feature? Will that work? https://docs.vapi.ai/calls/call-features#call-listen-feature i mean for the live call listening feature.
s
@Sahil this is extremely frustrating now. Do you even understand what my problem is? Can you read the title of this issue or our whole thread? It's astonishing how you just expect me to send you the stackblitz link every time but when I do send it and explain you the problem, you are unable to just acknowledge if something is working or not working as expected. You have wasted my time by suggesting me to use the call control feature but when I (and @ZigzagToYou#0504) that it isn't working you just redirected me back to using the
.send()
feature which wasn't working before too. I want to use Background Messaging!! I want to silently insert a system message into the chat history, not make the assistant speak it! Can you please connect me to someone else from the team? We were considering to upgrade to enterprise plan at Vapi if our POC works, but if this is the kind of support I am going to get, I don't think I want to anymore.
I just want to hear a simple acknowledge on if certain APIs are working as they are supposed to. If no, just tell me when they will be fixed
s
@Samesh Sorry for the inconvenience. We acknowledge that this is a bug where there is a delay or the voice restarts playing whenever a background message is sent. We will add it to our to-do list, and we will work on it. Unfortunately, we won't be able to provide you with any ETA as we are a small team and have a lot of feature requests that we need to complete.
s
That's totally alright. So, there are no alternative solutions to send background messages also right? The live call control also isn't working
@Shubham Bajaj
Would hosting my LLM on my own server (custom LLM) be of any help?
^@Shubham Bajaj @Sahil
@Shubham Bajaj What's the final update on this? You mentioned that you will tell the ETA on this fix after the office hours
5 Views