API Issue
# support
s
So I am using my CRM system to initiate calls to incoming leads for my clients The thing is, each client has a unique business name, and we want that to change in the prompt, so we create a unique make.com automation per client that is respnsible for sending an API request to Vapi, with a custom prompt / first message and pre-selected existing agent id (Screenshot attached) We want to use the SAME agent, but the prompt and first message has to be dynamic per client (using make.com variables) However, when the call is initiated, Vapi uses the prompt thats in the UI, and not the one in the API request How can I fix this? Thanks https://cdn.discordapp.com/attachments/1356009848050811122/1356009848298279056/image.png?ex=67eb0215&is=67e9b095&hm=b163f937953bc3e72a84b295d8860b60eaa150650438c8db690e33f65a1519f5&
v
Hi Simon! 👋 I understand you're having an issue where Vapi is using the prompt from the UI instead of the one you're sending in your API request through make.com. This is actually a known issue that other users have reported as well. Based on the information I found, there are a few potential solutions you can try: ### Issue with Your Current Structure Looking at your API request structure, I noticed you're trying to pass
systemPrompt
and
firstMessage
as variables within the
variableValues
object. However, this isn't the correct way to structure the request for overriding prompts. ### How to Fix It 1. **Use the correct structure for `assistantOverrides`**: Instead of putting
systemPrompt
and
firstMessage
inside
variableValues
, try structuring your request like this:
Copy code
json
   {
     "assistantId": "your-assistant-id",
     "assistantOverrides": {
       "firstMessage": "Your dynamic first message here",
       "messages": [
         {
           "role": "system",
           "content": "Your dynamic system prompt here"
         }
       ],
       "variableValues": {
         "otherVariable1": "value1",
         "otherVariable2": "value2"
       }
     },
     "customer": {
       "name": "Customer Name",
       "number": "Customer Number"
     },
     "phoneNumberId": "your-phone-id"
   }
2. **Note about `systemPrompt`**: According to [documentation I found](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1337126843790397591), the
systemPrompt
property is deprecated. Instead, use the
messages
array with the role set to "system" to pass your system prompt. 3. **PATCH request behavior**: When updating an assistant using PATCH requests, nested properties are overwritten by default. To ensure all properties are preserved, you must pass both the updated and previous properties as follows:
model: {...modelPrevProperties, ...updated}
. 4. **Check variable templating**:
If you're using template variables in your prompts (like
{{businessName}}
), make sure they're correctly defined in your prompts and that the corresponding values are passed in the
variableValues
object. ### Known Issue This appears to be a known issue with Vapi. Another user reported that "when creating or updating the prompt using the API, it defaults back to 'I am a helpful assistant' and ignores the firstmessage and the rest of the prompt." The Vapi team might be investigating this issue. As a workaround, some users have had success using webhooks instead of the Vapi module directly. Would you like me to provide more specific guidance on any of these potential solutions? Sources: - [Discord Thread about Overriding UI Prompt](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1337126843790397591) - [Discord Thread about Known Issues](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1344078332848767016) - [Discord Thread about PATCH Requests](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1336023224898814012)
a
Hey! To help track down this issue, could you share: - The call ID This would really help us figure out what went wrong!