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: Installation guide and Authentication.

Parameters

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

Usage

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

const connectionCfg = ConnectionConfig.DefaultConnectionConfig(
  ConnectionConfig.WithSDK({
    ApiKey: "YOUR_API_KEY_PLACEHOLDER",
  })
);

const phoneCallRequest = new CreatePhoneCallRequest();
const assistant = new AssistantDefinition();
assistant.setAssistantid("ASSISTANT_ID_PLACEHOLDER");
assistant.setVersion("latest");
phoneCallRequest.setAssistant(assistant);
phoneCallRequest.setFromnumber("FROM_NUMBER_PLACEHOLDER");
phoneCallRequest.setTonumber("TO_NUMBER_PLACEHOLDER");

CreatePhoneCall(connectionCfg, phoneCallRequest)
.then(x => {
    console.log(x);
    if (x.getSuccess()) {
    return;
    }
    const err = x.getError();
    if (err?.getHumanmessage()) console.error(err.getHumanmessage());
})
.catch(x => {
    console.dir(x);
});
import {
  AssistantDefinition,
  CreatePhoneCall,
  ConnectionConfig,
  CreatePhoneCallRequest,
} from "@rapidaai/nodejs";

let connectionCfg = ConnectionConfig.DefaultConnectionConfig(
  ConnectionConfig.WithSDK({
    ApiKey: "YOUR_API_KEY_PLACEHOLDER",
  })
);
const phoneCallRequest = new CreatePhoneCallRequest();
// define assistant
const assistant = new AssistantDefinition();
assistant.setAssistantid("ASSISTANT_ID_PLACEHOLDER");
assistant.setVersion("latest");
phoneCallRequest.setAssistant(assistant);
phoneCallRequest.setTonumber("TO_NUMBER_PLACEHOLDER");

CreatePhoneCall(connectionCfg, phoneCallRequest)
  .then((x) => {
    if (x.getSuccess()) {
      console.dir(x.getData().toObject());
      return;
    }
    const err = x.getError();
    if (err?.getHumanmessage()) console.error(err.getHumanmessage());
  })
  .catch((x) => {
    console.dir(x);
  });


import os
from rapida import (
    ConnectionConfig,
    create_phone_call,
    CreatePhoneCallRequest,
    AssistantDefinition,
)
from pprint import pprint

connectionConfig = ConnectionConfig.default_connection_config(
    ConnectionConfig.with_sdk(os.getenv("RAPIDA_API_KEY"))
)
call = CreatePhoneCallRequest(
    assistant=AssistantDefinition(
        assistantId=2230142097179373568,
        version="latest",
    ),
    toNumber="+14155550123",
)
response = create_phone_call(client_cfg=connectionConfig, request=call)
pprint(response)
package main

import (
	"context"
	"fmt"
	"os"

	"github.com/rapidaai/rapida-go/rapida/clients"
	"github.com/rapidaai/rapida-go/rapida/connections"
	protos "github.com/rapidaai/rapida-go/protos"
)

func main() {
	connectionConfig := connections.DefaultconnectionConfig(
		connections.WithSDK(os.Getenv("RAPIDA_API_KEY")),
	)
	response, err := clients.CreatePhoneCall(
		context.Background(),
		connectionConfig,
		&protos.CreatePhoneCallRequest{
			Assistant: &protos.AssistantDefinition{
				AssistantId: 2230142097179373568,
				Version:     "latest",
			},
			ToNumber:   "+14155550123",
			FromNumber: "+14155550124",
		},
	)
	if err != nil {
		fmt.Printf("error while creating phone call: %+v\n", err)
		return
	}
	fmt.Printf("create phone call response: %+v\n", response)
}

Response

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