vapi.send (‘add-message’) is not working as expect...
# support
w
I’m currently trying to implement a 10 mins timer for the call, so when it reached 10 min I wanted the assistant to say something like ‘10 mins has already passed, do you want to continue or end the call right now?’ so I’m trying to use background messages for that, vapi.send({ type: "add-message", message: { role: "system", content: "Ten minutes already passed, please remind the user about the time and asks the user if they want to end the call now or continue", }, }); but what happens is 2 things: - the assistant will stop talking for a moment when I send this message - the assitant will ‘ignores’ it and just continue talking about the topic and does not remind about the time at all please help to take a look into it, i’m using gpt-4o-realtime btw *also fyi if i use ‘say’ then everything will work correctly but the downside is i can only use hardcoded message vapi.send({ type: 'say', message: 'By the way, I noticed ten minute has already passed, do you want to continue chatting or end the call?', }); ^this works
c
Hey! To help track down this issue, could you share: \- The call ID \- When exactly this happened (the timestamp) \- What response you expected to get \- What response you actually got instead This would really help us figure out what went wrong!
w
- The call ID = 1c0fa16d-5f5c-4468-844c-348d3a3aa2a9 - When exactly this happened (the timestamp) = around 30 second in (since I'm simulating 10 mins timer for this call) - What response you expected to get = I expected the assistant to remind the user of 10 mins - What response you actually got instead = Assistant ignores the 10 mins timer and continue speaking (as if ignoring the message) Code to send background message: vapi.send({ type: 'add-message', message: { role: 'system', content: 'Also it seems like 10 minutes have passed, ask the user if they want to stop the exercise', }, });
as you can see the assistant/bot just ignore the
system
message about the 10 mins reminder
c
Hi wraithunder, To achieve your goal of reminding users at the 10-minute mark during a call, using a background message is not the appropriate method. Background messages are meant for silently logging information without user notification. Instead, you should schedule a timer to send a direct message through your assistant. Here’s what you can do: 1. **Set a Timer**: Use your server or client-side logic to start a timer when the call begins. 2. **Trigger a Message**: When the timer hits 10 minutes, send a proactive message to the user. If you intend to use your assistant to say the reminder, ensure the message is sent in the context of the ongoing conversation:
Copy code
javascript
// example function call when time reaches 10 minutes
function tenMinuteReminder() {
  vapi.send({
    type: "message",
    message: {
      role: "assistant",
      content: "Ten minutes have passed. Would you like to continue or end the call?"
    },
  });
}
This will ensure the message is actively delivered to the user instead of being silently logged. For handling specific conversational logic, ensure your assistant's message configuration supports this interaction. For more detailed configurations, check out documentation about managing calls and using system messages here [Server Events](https://docs.vapi.ai/server-url/events).
w
ah okay… thanks I will do that
c
Let us know if you need additional support!
4 Views