This sample demonstrates how to use the RCS Business Messaging Java client library for performing operations with the RCS Business Messaging API to execute a bulk capability check against an input list of phone numbers.
The output of the script will show the potential reachability of the provided users based on random sampling. If your RBM agent is launched, the script will also output all reachable phone numbers for the carriers in which your agent is launched for.
This application assumes that you're signed up with RCS Business Messaging.
The documentation for the RCS Business Messaging API can be found here.
You must have the following software installed on your machine:
- Apache Maven 3.3.9 or greater
- Java 8
- Register with RCS Business Messaging.
- Open the Business Communications Developer Console (https://business-communications.cloud.google.com/console/) with your registered Google account and create a new RBM agent.
- When the agent is available, click the agent's card.
- In the left navigation, click Service account.
- Click Create key, then click Create. Your browser downloads a service account key for your agent. You need this key to make RBM API calls as your agent.
- Rename the service account key "rbm-agent-service-account-credentials.json" and move it into the "rbm-java-cap-check/src/main/resources" directory.
-
In a terminal, navigate to this sample's root directory.
-
Run the following commands:
mvn compile && mvn exec:java -Dexec.args="INPUT_FILE OUTPUT_FILE NUM_OF_THREADS START_INDEX END_INDEX"
The NUM_OF_THREADS, START_INDEX and END_INDEX parameters are optional. By default, the NUM_OF_THREADS is set to 10, but you can use this option to increase the value. The START_INDEX and END_INDEX parameters select a subset of numbers from the INPUT_FILE.
Prior to running this script with a large amount of threads, you should adjust the default Java memory allocation by setting the Maven run options with the following command:
export MAVEN_OPTS="-Xms1024m -Xmx3000m"
In our tests, this script using only a single thread can check the capability of 1,000,000 devices in about 2 minutes running on a MacBook Pro with 2.8 GHz Quad-Core Intel Core i7 CPU and 16 GB of RAM. With the default of 10 threads, this program can check 1,000,000 users in about 15 seconds.
To learn more about setting up RCS Business Messaging see the documentation.