Skip to main content
Creates an outbound phone call to the specified number using your configured assistant.
For full setup and authentication options, see the Installation guide: /api-reference/introduction.

Parameters

connectionConfig
ConnectionConfig
required
Configuration for the client connection.
request
CreatePhoneCallRequest
required

Usage

import {
  ConnectionConfig,
  CreatePhoneCall,
  AssistantDefinition,
  CreatePhoneCallRequest,
} from '@rapidaai/react';

const phoneCallRequest = new CreatePhoneCallRequest();
const assistant = new AssistantDefinition();
assistant.setAssistantid("ASSISTANT_ID");
assistant.setVersion('latest');
phoneCallRequest.setAssistant(assistant);
phoneCallRequest.setFromnumber('FROM_NUMBER');
phoneCallRequest.setTonumber("TO_NUMBER");
let connectionCfg = ConnectionConfig.DefaultConnectionConfig(
    ConnectionConfig.WithPersonalToken({
        Authorization: token,
        AuthId: authId,
        ProjectId: projectId,
    }),
);

CreatePhoneCall(connectionCfg, phoneCallRequest)
.then(x => {
    console.log(x);
    if (x.getSuccess()) {
    return;
    }
    let err = x.getError();
    if (err?.getHumanmessage()) setError(err?.getHumanmessage());
})
.catch(x => {
    console.dir(x);
});

Response

code
int
Numeric status code for the operation
success
boolean
Indicates whether the operation was successful
error
Error
data
AssistantConversation