Cannot create call using the web sdk
# support
t
I'm trying to create a call using the web SDK but im getting this error "Couldn't Get Call Resources. Error: Cannot read properties of null (reading 'replace')" im only sending this as the payload
Copy code
{
  "assistantId": "4",
  "assistantOverrides": {
    "variableValues": {
      "username": "taha",
      "company_description": "",
      "job_description": "foobar",
      "custom_questions": null,
      "job_title": "Software Engineer",
      "lang": "en"
    },
    "responseDelaySeconds": 0,
    "llmRequestDelaySeconds": 0,
    "metadata": {
      "interviewId": "123"
    },
    "serverUrl": "https://894a-206-42-122-82.ngrok-free.app/v1/interviews/callback"
  }
}
v
@taha It seems like there might be an issue with the payload structure you're using for creating a call. The error message "Cannot read properties of null (reading 'replace')" suggests that the code is trying to access a property on an object that is null, which could be due to a missing or incorrectly specified parameter in your payload. Based on the context provided, the payload for creating a call should include parameters such as
customerId
,
customer
details (including
number
,
name
,
extension
),
phoneNumberId
, and
phoneNumber
details (including
twilioPhoneNumber
,
twilioAccountSid
,
twilioAuthToken
,
name
,
assistantId
). The payload you've provided seems to be related to an assistant configuration rather than a call setup. To create a call using the VAPI, you would need to provide the necessary call parameters. Here's an example of what the payload should look like for creating a call:
Copy code
json
{
  "customerId": "your_customer_id",
  "customer": {
    "number": "customer_phone_number",
    "name": "customer_name",
    "extension": "customer_phone_extension"
  },
  "phoneNumberId": "your_phone_number_id",
  "phoneNumber": {
    "twilioPhoneNumber": "your_twilio_phone_number",
    "twilioAccountSid": "your_twilio_account_sid",
    "twilioAuthToken": "your_twilio_auth_token",
    "name": "your_phone_number_name",
    "assistantId": "your_assistant_id"
  }
}
Please ensure that you replace the placeholders with actual values relevant to your setup. If you provide me with the correct parameters, I can help you format the payload correctly and initiate the call. If you're unsure about the parameters, please ask support for more info on this.
You can continue this conversation by mentioning me in the message.
t
@Vapi im creating a web call so i dont need the
customer
details or twilio details
v
@taha Understood. If you're creating a web call and not using Twilio or customer details, the payload structure might be different. The error you're encountering suggests that there's a null reference somewhere in your code or payload, which could be due to an optional field being null or not handled correctly. The payload you've provided seems to be for setting up an assistant with overrides, which might not be the direct cause of the error. The error message indicates that somewhere in your code, a 'replace' function is being called on a null object. This could be happening in the web SDK where it expects a non-null value. To resolve this, you should: 1. Check the web SDK documentation for the correct payload structure and required fields when initiating a web call. 2. Ensure that all required fields are provided and that optional fields are either omitted or handled properly in the code to avoid null reference errors. 3. If the 'replace' function is being used in your code, ensure that the variable it's being called on is properly initialized and not null. If you can provide more details about the web SDK you're using or the specific function you're calling to initiate the web call, I can give you more targeted advice. Otherwise, please review the SDK documentation or ask support for more info on this.
t
@Vapi im using the vapi.start function and im passing the assistant_id and the payload i sent above as the second param. im using the latest version of vapi web sdk