Assistance System Prompt and First message configu...
# support
s
How can we set the system prompt and first message for assistance through api dynamically?
v
@Subhashish Jung Shah To set the system prompt and the first message for assistance dynamically through the API, you can use the template feature with double curly braces
{{variableName}}
. Here's how you can do it: 1. Define your templates with placeholders for the dynamic content. For example: - System Prompt Template: "Hello {{userName}}, how can I assist you today?" - First Message Template: "I see you're interested in {{productInterest}}. Let's get started!" 2. When starting a call or session through the API, you would pass the actual values for these placeholders as part of the API request. For instance: -
userName
could be replaced with the actual user's name, e.g., "Alex". -
productInterest
could be replaced with the actual product the user is interested in, e.g., "voice-enabled applications". 3. The API will then replace the placeholders with the actual values and use the customized prompts and messages for that specific call. If you need to implement this and require the exact API endpoint or method to set these templates, please provide the specific details of the API or the system you are using, and I can guide you further. If this is a feature you'd like to add to your existing API and need assistance with the implementation, please ask support for more info on this.
You can continue this conversation by mentioning me in the message.
s
@Vapi i mean how can we set the whole system pormpt and first message through api for a assistance from my application?
v
@Subhashish Jung Shah To set the whole system prompt and the first message for assistance from your application through an API, you would typically need to: 1. **Identify the API Endpoint**: Determine the correct API endpoint provided by the Voice API (VAPI) that allows you to configure system prompts and messages. 2. **Prepare the Payload**: Create a JSON payload that includes the system prompt and first message text. This payload will be sent in the body of your API request. 3. **Make the API Call**: Use an HTTP client in your application to make a POST or PUT request to the identified endpoint with the payload. Here's a hypothetical example of how you might do this:
Copy code
json
{
  "systemPrompt": "Welcome to our service. How can we assist you today?",
  "firstMessage": "To get started, please tell me what you need help with."
}
And the corresponding API call might look like this in a programming language like JavaScript using `fetch`:
Copy code
javascript
fetch('https://api.voice.example.com/settings/prompts', {
  method: 'POST', // or 'PUT' depending on the API specification
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_API_TOKEN'
  },
  body: JSON.stringify({
    systemPrompt: "Welcome to our service. How can we assist you today?",
    firstMessage: "To get started, please tell me what you need help with."
  })
})
.then(response => response.json())
.then(data => console.log(data))
.catch((error) => console.error('Error:', error));
Please replace
https://api.voice.example.com/settings/prompts
with the actual endpoint you need to call and
YOUR_API_TOKEN
with your actual API token. If you need the exact details on how to make this API call for VAPI, you would need to consult the API documentation provided by the service. If such documentation is not available or if you are unsure about the process, please ask support for more info on this.
Got it. Tagging @User for additional help.
s
what is the endpoint for doing so is my question
58 Views