An agent is an conversational entity that interacts with users by sending messages and reacting to users' responses. Users interact with agents with an RCS-enabled messaging app, such as the Messages app, on their devices. In this example, you'll create a basic RBM agent that can send a simple message to a test device and receive a response.
Before you get started with your agent, you'll need the following items:
- Your RBM Platform Google account
- Your agent's name
- An Android device with an active phone number
- A development machine that can run sample code
Set up your test device
To communicate with an unlaunched RBM agent, a test device needs to be RCS-enabled, but not all Android devices can receive RCS messages by default. You can check the RCS status of your device and, if necessary, enable RCS by configuring your device with pre-release versions of the Messages and Carrier Services apps.
Check the RCS status of your device
- In the Messages app, tap the button, then tap Settings
Tap Chat features, and find the Status value.
If Status is Connected, RCS is active on your device.
Set up your agent
RBM agents use the RCS Business Messaging API to send messages, events, and other requests to users. When you create an agent, you enable access to the RBM API and define your agent's name and region.
Identify the agent's region
The RBM API supports three regional endpoints to help businesses comply with regional and business requirements. Likewise, RBM agents can exist in one of three regions:
- North America
- Asia Pacific
When you create your agent, choose your agent's region based on applicable regulations, requirements, and proximity to end users. Region determines where your agent operates from and where it stores its data.
Create the agent
Before you do anything else, create your agent in the Business Communications Developer Console.
- Open the Business Communications Developer Console and sign in with your RBM Google account.
- Click Create agent.
- Enter your agent's name and region, then click Create agent.
- When your agent is available, click your agent's name.
Once your agent is available, you can add business and branding information. See Agents.
Create a service account key
To send messages and events as your agent, you need to authenticate API calls with a service account key. The Business Communications Developer Console creates a service account for you, but you need to create a unique key to access your agent.
- In the left navigation, click Service account.
- Click Create key, then click Create.
- Rename the downloaded key to "rbm-agent-service-account-credentials.json".
- Store the key in a secure location on your development machine. The key can't be recovered if lost.
Invite your test device
Now that you have an agent and your test device is RCS-enabled, you can invite your device to test your agent.
- In the left navigation, click Devices.
- For Add test devices, enter your device's phone number and click Add.
- On your test device, accept the tester request for your agent.
If you don't receive an invitation on your test device, verify that RCS is enabled on your device.
Send a message
With a registered test device, your agent can now send messages.
In a terminal on your development machine, run the following command.
- Replace REGION with
us, depending on your agent's region.
- Replace PHONE_NUMBER with phone number of your
test device, including the country code, the area code, and a leading
+, but don't include separators. For example,
- Replace PATH_TO_SERVICE_ACCOUNT_KEY with the path to the key you created earlier.
You should receive a "Hello, world!" message from your agent on your test device.
If you don't receive a message on your test device, verify that you correctly input and formatted the phone number and path to your service account key in the command.
Now that your agent can send messages to a test device, it's time to build something that suits your business needs. Get a sample agent in the language of your preference and follow the instructions in the sample's README.