For setup and authentication options, see the Installation guide and Authentication.
Parameters
Configuration for the client connection.
Provide the
whatsapp deployment variant.Show child attributes
Show child attributes
WhatsApp deployment configuration.
Show child attributes
Show child attributes
Assistant ID for the deployment.
WhatsApp provider name.
Provider-specific WhatsApp options.
First message the assistant sends when the session starts.
Controls whether users can interrupt the opening greeting in audio sessions.
Message to use when the assistant cannot understand or handle the input.
Idle timeout in seconds. Must be between
15 and 120.Number of idle-timeout retries. Must be between
0 and 5.Message sent when the session reaches the idle timeout.
Maximum session duration in seconds. Must be between
180 and 600.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.setGreetinginterruptible(false);
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());
import {
AssistantWhatsappDeployment,
ConnectionConfig,
CreateAssistantDeploymentRequest,
CreateAssistantWhatsappDeployment,
Metadata,
} from "@rapidaai/nodejs";
const auth = ConnectionConfig.WithDebugger({
authorization: process.env.RAPIDA_AUTHORIZATION,
userId: process.env.RAPIDA_AUTH_ID,
projectId: process.env.RAPIDA_PROJECT_ID,
});
const connectionCfg = ConnectionConfig.DefaultConnectionConfig(auth);
const deployment = new AssistantWhatsappDeployment();
deployment.setAssistantid(process.env.RAPIDA_ASSISTANT_ID);
deployment.setGreeting("Hi, how can I help you today?");
deployment.setGreetinginterruptible(false);
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());
import os
from pprint import pprint
from rapida import (
AssistantWhatsappDeployment,
ConnectionConfig,
Metadata,
)
from rapida.clients.protos.assistant_deployment_pb2 import (
CreateAssistantDeploymentRequest,
)
auth = ConnectionConfig.with_debugger(
authorization=os.getenv("RAPIDA_AUTHORIZATION"),
user_id=os.getenv("RAPIDA_AUTH_ID"),
project_id=os.getenv("RAPIDA_PROJECT_ID"),
)
connection_config = ConnectionConfig.default_connection_config(auth)
deployment = AssistantWhatsappDeployment(
assistantId=int(os.getenv("RAPIDA_ASSISTANT_ID")),
greeting="Hi, how can I help you today?",
greetingInterruptible=False,
mistake="Sorry, I did not understand that.",
idealTimeout=30,
idealTimeoutBackoff=2,
idealTimeoutMessage="Are you still there?",
maxSessionDuration=300,
whatsappProviderName="gupshup",
whatsappOptions=[Metadata(key="template", value="welcome")],
)
response = connection_config.assistant_deployment_client.CreateAssistantWhatsappDeployment(
CreateAssistantDeploymentRequest(whatsapp=deployment),
metadata=connection_config.auth,
)
pprint(response)
package main
import (
"context"
"fmt"
"os"
"google.golang.org/protobuf/proto"
clients "github.com/rapidaai/rapida-go/rapida/clients"
connections "github.com/rapidaai/rapida-go/rapida/connections"
protos "github.com/rapidaai/rapida-go/protos"
)
func main() {
connectionConfig := connections.DefaultconnectionConfig(
connections.WithPersonalToken(
os.Getenv("RAPIDA_AUTHORIZATION"),
os.Getenv("RAPIDA_AUTH_ID"),
os.Getenv("RAPIDA_PROJECT_ID"),
),
)
response, err := clients.CreateAssistantWhatsappDeployment(
context.Background(),
connectionConfig,
&protos.CreateAssistantDeploymentRequest{
Deployment: &protos.CreateAssistantDeploymentRequest_Whatsapp{
Whatsapp: &protos.AssistantWhatsappDeployment{
AssistantId: 2227823180112723968,
Greeting: proto.String("Hi, how can I help you today?"),
GreetingInterruptible: proto.Bool(false),
Mistake: proto.String("Sorry, I did not understand that."),
IdealTimeout: 30,
IdealTimeoutBackoff: 2,
IdealTimeoutMessage: "Are you still there?",
MaxSessionDuration: 300,
WhatsappProviderName: "gupshup",
WhatsappOptions: []*protos.Metadata{{
Key: "template",
Value: "welcome",
}},
},
},
},
)
if err != nil {
fmt.Printf("error while creating deployment: %+v\n", err)
return
}
fmt.Printf("create deployment response: %+v\n", response)
}
Response
Numeric status code for the operation.
Indicates whether the operation was successful.
Created WhatsApp deployment.
Show child attributes
Show child attributes
Unique identifier for the deployment.
Assistant ID for the deployment.
WhatsApp provider name.
Provider-specific WhatsApp options.
First message for the session.
Controls whether users can interrupt the opening greeting in audio sessions.
Message used when the assistant cannot understand or handle input.
Current deployment status.
Idle timeout in seconds.
Number of idle-timeout retries.
Message sent on idle timeout.
Maximum session duration in seconds.
Errors
| Code | Meaning |
|---|---|
1008001 | Invalid request. |
1008002 | Unauthenticated request. |
1008003 | Missing authentication scope. |
1008004 | Invalid assistantId. |
1008005 | Unable to create assistant WhatsApp deployment. |
1008006 | idealTimeout must be between 15 and 120 seconds. |
1008007 | idealTimeoutBackoff must be between 0 and 5 times. |
1008008 | maxSessionDuration must be between 180 and 600 seconds. |
1008009 | Missing whatsappProviderName. |