serverMessages WebSDK
# support
a
The new SDK has a bug:
Copy code
/**
     * These are the messages that will be sent to your Client SDKs. Default is conversation-update,function-call,hang,model-output,speech-update,status-update,transfer-update,transcript,tool-calls,user-interrupted,voice-input,workflow.node.started. You can check the shape of the messages in ClientMessage schema.
     * @example ["conversation-update","function-call","hang","model-output","speech-update","status-update","transfer-update","transcript","tool-calls","user-interrupted","voice-input","workflow.node.started"]
     */
    clientMessages?: 'conversation-update' | 'function-call' | 'function-call-result' | 'hang' | 'language-changed' | 'metadata' | 'model-output' | 'speech-update' | 'status-update' | 'transcript' | 'tool-calls' | 'tool-calls-result' | 'tool.completed' | 'transfer-update' | 'user-interrupted' | 'voice-input' | 'workflow.node.started';
    /**
     * These are the messages that will be sent to your Server URL. Default is conversation-update,end-of-call-report,function-call,hang,speech-update,status-update,tool-calls,transfer-destination-request,user-interrupted. You can check the shape of the messages in ServerMessage schema.
     * @example ["conversation-update","end-of-call-report","function-call","hang","speech-update","status-update","tool-calls","transfer-destination-request","user-interrupted"]
     */
    serverMessages?: 'conversation-update' | 'end-of-call-report' | 'function-call' | 'hang' | 'language-changed' | 'language-change-detected' | 'model-output' | 'phone-call-control' | 'speech-update' | 'status-update' | 'transcript' | "transcript[transcriptType='final']" | 'tool-calls' | 'transfer-destination-request' | 'transfer-update' | 'user-interrupted' | 'voice-input';
You can see that the example state you can pass an array, however the type is only a OR configuration.
v
You're correct—this is a type definition bug. According to the Vapi documentation, both
clientMessages
and
serverMessages
should accept an array of message types, not just a single value. The SDK's type should look like:
Copy code
ts
clientMessages?: (
  | 'conversation-update'
  | 'function-call'
  // ...other types
)[];
Action: Report this to the SDK maintainers or patch your local types to accept arrays as shown above. [See Vapi docs for reference](https://docs.vapi.ai/api-reference/assistants/create?explorer=true) Sources: - [Vapi API Reference: Create Assistant](https://docs.vapi.ai/api-reference/assistants/create?explorer=true) - [Vapi Changelog May 8, 2025](https://docs.vapi.ai/changelog/2025/5/8)
v
To resolve the 400 error, update your local type definitions so that
serverMessages
and
clientMessages
accept arrays of unique message types, as required by the Vapi API:
Copy code
ts
serverMessages?: (
  | 'conversation-update'
  | 'end-of-call-report'
  | 'function-call'
  // ...other types
)[];
Patch your SDK types as above, and ensure you only pass arrays with unique values. [See Vapi docs for reference](https://docs.vapi.ai/api-reference/assistants/create?explorer=true) Sources: - [Vapi API Reference: Create Assistant](https://docs.vapi.ai/api-reference/assistants/create?explorer=true) - [Vapi Changelog May 8, 2025](https://docs.vapi.ai/changelog/2025/5/8)
To resolve the error, update your SDK types so that
clientMessages
and
serverMessages
are arrays of unique message types, not single values.
For example:
Copy code
ts
clientMessages?: (
  | 'conversation-update'
  | 'function-call'
  // ...other types
)[];
serverMessages?: (
  | 'conversation-update'
  | 'end-of-call-report'
  // ...other types
)[];
Patch your local SDK types or report this to the maintainers to ensure compliance with the Vapi API requirements. [See Vapi API Reference for details](https://docs.vapi.ai/api-reference/assistants/create?explorer=true) Sources: - [Vapi API Reference: Create Assistant](https://docs.vapi.ai/api-reference/assistants/create?explorer=true) - [Vapi Changelog May 8, 2025](https://docs.vapi.ai/changelog/2025/5/8)
k
Hey @Alberto, thanks for reporting it let me work on it.
a
Thanks mat!
// @ts-expect-error Vapi's official documentation examples show arrays are valid for clientMessages, but the SDK's TypeScript type is currently a single string union. clientMessages: [ "transcript", "hang", "function-call", "speech-update", "metadata", "conversation-update" ], // @ts-expect-error Vapi's official documentation examples show arrays are valid for serverMessages, but the SDK's TypeScript type is currently a single string union. serverMessages: [ "end-of-call-report" ], FYI: this is the workaround if anyone else is experiencing the same