Skip to main content
Creates a WhatsApp deployment for an assistant. Use user-scoped authentication because the operation requires organization and project context.
For setup and authentication options, see the Installation guide and Authentication.

Parameters

connectionConfig
ConnectionConfig
required
Configuration for the client connection.
request
CreateAssistantDeploymentRequest
required
Provide the whatsapp deployment variant.

Usage

import {
  AssistantWhatsappDeployment,
  ConnectionConfig,
  CreateAssistantDeploymentRequest,
  CreateAssistantWhatsappDeployment,
  Metadata,
} from "@rapidaai/react";

const auth = ConnectionConfig.WithDebugger({
  authorization: "AUTHORIZATION_TOKEN_PLACEHOLDER",
  userId: "AUTH_ID_PLACEHOLDER",
  projectId: "PROJECT_ID_PLACEHOLDER",
});
const connectionCfg = ConnectionConfig.DefaultConnectionConfig(auth);

const deployment = new AssistantWhatsappDeployment();
deployment.setAssistantid("ASSISTANT_ID_PLACEHOLDER");
deployment.setGreeting("Hi, how can I help you today?");
deployment.setMistake("Sorry, I did not understand that.");
deployment.setIdealtimeout("30");
deployment.setIdealtimeoutbackoff("2");
deployment.setIdealtimeoutmessage("Are you still there?");
deployment.setMaxsessionduration("300");
const template = new Metadata();
template.setKey("template");
template.setValue("welcome");
deployment.setWhatsappprovidername("gupshup");
deployment.setWhatsappoptionsList([template]);

const request = new CreateAssistantDeploymentRequest();
request.setWhatsapp(deployment);

const response = await CreateAssistantWhatsappDeployment(connectionCfg, request);
console.dir(response.toObject());

Response

code
int32
Numeric status code for the operation.
success
boolean
Indicates whether the operation was successful.
data
AssistantWhatsappDeployment
Created WhatsApp deployment.
error
Error
Error details when the operation fails.

Errors

CodeMeaning
1008001Invalid request.
1008002Unauthenticated request.
1008003Missing authentication scope.
1008004Invalid assistantId.
1008005Unable to create assistant WhatsApp deployment.
1008006idealTimeout must be between 15 and 120 seconds.
1008007idealTimeoutBackoff must be between 0 and 5 times.
1008008maxSessionDuration must be between 180 and 600 seconds.
1008009Missing whatsappProviderName.