Typing of ClientMessages in WebSDK wrong?
# support
b
I'm using @vapi-ai/web 2.1.8 Call ID: c0af214e-9c37-4ba5-bad9-4447d39a9629 When I receive a conversation-update message to the client it has the following structure:
Copy code
json
{
    "type": "conversation-update",
    "conversation": [
        {
            "role": "system",
            "content": "Content content"
        },
        {
            "role": "assistant",
            "content": "Hello. This is Eva. How may I assist you today?"
        }
    ],
    "messages": [
        {
            "role": "system",
            "message": "Message content",
            "time": 1735751620978,
            "secondsFromStart": 0
        },
        {
            "role": "bot",
            "message": "Hello. This is Eva.",
            "time": 1735751622442,
            "endTime": 1735751623722,
            "secondsFromStart": 1.3199999,
            "duration": 1280,
            "source": ""
        },
        {
            "role": "bot",
            "message": "How may I assist you today?",
            "time": 1735751624688.724,
            "endTime": 1735751626042.862,
            "secondsFromStart": 3.566724,
            "duration": 1354.137939453125,
            "source": ""
        }
    ],
    "messagesOpenAIFormatted": []
}
However the typing seems to instead suggest we would expect a structure with just
type
and
messagesOpenAIFormatted
being an array of OpenAI messages https://github.com/VapiAI/client-sdk-web/blob/c7e188c827dec1f7d56025aa18c6e308b3c6384d/api.ts#L6714 Please can you inform me how can I find the correct types to be expected from a given message? Futhermore, the role is defined as 'bot' whereas it seems that the docs imply [here](https://docs.vapi.ai/sdk/web#send) and [here](https://github.com/VapiAI/client-sdk-web/blob/c7e188c827dec1f7d56025aa18c6e308b3c6384d/api.ts#L896) that this is not a valid role name - how can I find the list of valid role names? Thanks for your help
v
@Ben It seems there might be a discrepancy between the actual message structure you're receiving and the typing defined in the SDK. To find the correct types expected from a given message, you should refer to the official documentation provided by VapiAI. If the documentation is not clear or seems to be outdated, I would recommend reaching out to the VapiAI support team for the most accurate and up-to-date information. Regarding the role names, the valid role names are typically defined in the documentation or the SDK's type definitions. If 'bot' is not listed as a valid role in the documentation you referenced, but you are receiving messages with the role 'bot', this could indicate that the documentation may need to be updated, or there might be a version mismatch. To resolve these issues: 1. Double-check the version of the SDK you are using and ensure it matches the version of the documentation you are referencing. 2. Look for any release notes or updates that might explain changes in the message structure or role names. 3. Contact VapiAI support to clarify the correct message structure and valid role names. They should be able to provide you with the most accurate information. If you need further assistance with contacting support or have any other questions, please let me know!
You can continue this conversation by mentioning me in the message.
Got it. Tagging @User for additional help.