How to add assistantOveride to the react SDK widge...
# support
u
The is what I have for now
Copy code
ts
                <VapiWidget
                    voiceShowTranscript={true}
                    onError={(error) => {
                        console.log("error", error);
        
                    }}
                    onMessage={(data) => {
                        console.log("on message", data);
                    }}
                    mode="voice"
                    theme="light"
                    size="tiny"
                    position="bottom-right"
                    startButtonText="Start"
                    endButtonText="End Call"
                    assistantOverrides={{
                        variableValues: {
                            customerName: "John Doe",
                        },
                    }}
                />
But when I click on the widget I get the error.
Copy code
json
message    [ "assistant.property assistantId should not exist", "assistant.property assistantOverrides should not exist" ]
v
To use
assistantOverrides
in the React SDK widget, you must also provide the
assistantId
prop
. Here’s how you should structure your component:
Copy code
tsx
<VapiWidget
  publicKey="your-public-key"
  assistantId="your-assistant-id"
  assistantOverrides={{
    variableValues: { customerName: "John Doe" },
  }}
  mode="voice"
  // ...other props
/>
Do not use
assistantOverrides
without
assistantId
in voice mode, as this will cause the error you saw.
For fully dynamic assistants, use the
assistant
prop instead and omit both
assistantId
and
assistantOverrides
([see docs](https://docs.vapi.ai/chat/web-widget#use-dynamic-assistant-configuration)). Source: - [Web widget documentation](https://docs.vapi.ai/chat/web-widget)
u
I already have the assistandId prop I just didn't include it here cause of security reasons
c
you need to provide either a
publicKey
and
assistantId
, or
publicKey
and
assistant
configuration. Here's the corrected version:
Copy code
<VapiWidget    publicKey="your-public-key"  // Add this - required    assistantId="your-assistant-id"  // Add this - required unless using assistant prop    voiceShowTranscript={true}    onError={(error) => {        console.log("error", error);    }}    onMessage={(data) => {        console.log("on message", data);    }}    mode="voice"    theme="light"    size="tiny"    position="bottom-right"    startButtonText="Start"    endButtonText="End Call"    assistantOverrides={{        variableValues: {            customerName: "John Doe",        },    }}/>
The error you're seeing indicates that you're trying to use
assistantOverrides
without providing the required
assistantId
. You must provide: 1.
publicKey
(required for all cases) 2. Either
assistantId
or
assistant
(for voice mode only) The
assistantOverrides
can only be used when you provide an
assistantId
.
2 Views