-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated README, fixed missing defaultLocale for the location sample
- Loading branch information
Sean Falconer
committed
Oct 29, 2020
1 parent
ea4a824
commit a3f6af3
Showing
3 changed files
with
71 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,91 +1,109 @@ | ||
# BUSINESS COMMUNICATIONS: Command-Line Sample | ||
|
||
This sample demonstrates how to use the Java SDK for performing operations | ||
with the [Business Communications API](https://businesscommunications.googleapis.com) | ||
This sample demonstrates how to use the [Business Communications Java client library](https://github.com/google-business-communications/java-businesscommunications) for performing operations | ||
with the [Business Communications API](https://businesscommunications.googleapis.com). | ||
|
||
This application assumes that you're signed up with | ||
[Business Messages](https://developers.google.com/business-communications/business-messages/guides/set-up/register). | ||
|
||
## PREREQUISITES | ||
## Documentation | ||
|
||
The documentation for the Business Commmunications API can be found [here](https://developers.google.com/business-communications/business-messages/reference/business-communications/rest). | ||
|
||
## Prerequisite | ||
|
||
You must have the following software installed on your machine: | ||
|
||
* [Apache Maven](http://maven.apache.org) 3.3.9 or greater | ||
* [Java 8](http://www.oracle.com/technetwork/java/javase/downloads/index.html) | ||
|
||
## SETUP | ||
|
||
Register with Business Messages: | ||
## Before you begin | ||
|
||
1. Open [Google Cloud Console](https://console.cloud.google.com) with your | ||
Business Messages Google account and create a new project for your agent. | ||
1. [Register with Business Messages](https://developers.google.com/business-communications/business-messages/guides/set-up/register). | ||
1. Once registered, follow the instructions to [enable the APIs for your project](https://developers.google.com/business-communications/business-messages/guides/set-up/register#enable-api). | ||
|
||
Note the **Project ID** and **Project number** values. | ||
### Setup your API authentication credentials | ||
|
||
2. Open the | ||
[Business Communications API](https://console.developers.google.com/apis/library/businesscommunications.googleapis.com) | ||
in the API Library. | ||
This sample application uses a service account key file to authenticate the Business Communication API calls for your registered Google Cloud project. You must download a service account key and configure it for the sample. | ||
|
||
3. Click **Enable**. | ||
To download a service account key and configure it for the sample, follow the instructions below. | ||
|
||
4. [Register your project](https://developers.google.com/business-communications/business-messages/guides/set-up/register) | ||
with Business Messages. | ||
1. Open [Google Cloud Console](https://console.cloud.google.com) with your | ||
Business Messages Google account and make sure you select the project that you registered for Business Messages with. | ||
|
||
5. Create a service account. | ||
1. Create a service account. | ||
|
||
1. Navigate to [Credentials](https://console.cloud.google.com/apis/credentials). | ||
1. Navigate to [Credentials](https://console.cloud.google.com/apis/credentials). | ||
|
||
2. Click **Create service account**. | ||
2. Click **Create service account**. | ||
|
||
3. For **Service account name**, enter your agent's name, then click **Create**. | ||
3. For **Service account name**, enter your agent's name, then click **Create**. | ||
|
||
4. For **Select a role**, choose **Project** > **Editor**, the click **Continue**. | ||
4. For **Select a role**, choose **Project** > **Editor**, then click **Continue**. | ||
|
||
5. Under **Create key**, choose **JSON**, then click **Create**. | ||
5. Under **Create key**, choose **JSON**, then click **Create**. | ||
|
||
Your browser downloads the service account key. Store it in a secure location. | ||
Your browser downloads the service account key. Store it in a secure location. | ||
|
||
6. Click **Done**. | ||
|
||
7. Copy the JSON credentials file into this sample's /src/main/resources | ||
7. Copy the JSON credentials file into this sample's /resources | ||
folder and rename it to "bc-agent-service-account-credentials.json". | ||
|
||
## RUN THE SAMPLE | ||
## Samples | ||
|
||
### Brand CRUD operations | ||
|
||
This sample demonstrates how to create a new brand, get brand details, update a brand, list all brands, and remove the created brand. | ||
|
||
View the [source code](https://github.com/google-business-communications/bc-bm-java-command-line-examples/blob/master/src/main/java/com/google/businesscommunications/businessmessages/samples/BrandSample.java). | ||
|
||
Usage: | ||
|
||
```bash | ||
mvn compile && mvn exec:java -Dexec.mainClass="com.google.businesscommunications.businessmessages.samples.BrandSample" | ||
``` | ||
|
||
Alternative usage: | ||
|
||
```bash | ||
mvn compile && mvn exec:java -Dexec.mainClass="com.google.businesscommunications.businessmessages.samples.BrandSample" -Dexec.args="NO-DELETE" | ||
``` | ||
|
||
If the NO-DELETE argument exists, the brand that gets created by the sample will not be deleted. | ||
|
||
1. In a terminal, navigate to this sample's root directory. | ||
### Agent CRUD operations | ||
|
||
2. Run the methods: | ||
* Brand API example: | ||
This sample demonstrates how to create a new agent, get agent details, update the agent, list all agent, and remove the created agent. | ||
|
||
mvn compile && mvn exec:java -Dexec.mainClass="com.google.businesscommunications.businessmessages.samples.BrandSample" | ||
View the [source code](https://github.com/google-business-communications/bc-bm-java-command-line-examples/blob/master/src/main/java/com/google/businesscommunications/businessmessages/samples/AgentSample.java). | ||
|
||
* Brand API example without brand deletion: | ||
Usage: | ||
|
||
mvn compile && mvn exec:java -Dexec.mainClass="com.google.businesscommunications.businessmessages.samples.BrandSample" -Dexec.args="NO-DELETE" | ||
```bash | ||
mvn compile && mvn exec:java -Dexec.mainClass="com.google.businesscommunications.businessmessages.samples.AgentSample" -Dexec.args="BRAND_NAME" | ||
``` | ||
|
||
If the NO-DELETE argument exists, the brand that gets created by the | ||
sample will not be deleted. | ||
Replace BRAND_NAME with a valid brand ID in "brands/BRAND_ID" format. If you haven't created a brand, run the brand sample with the NO-DELETE argument to create a brand to reference. | ||
|
||
* Agent API example: | ||
Alternative usage: | ||
|
||
mvn compile && mvn exec:java -Dexec.mainClass="com.google.businesscommunications.businessmessages.samples.AgentSample" -Dexec.args="BRAND_NAME" | ||
```bash | ||
mvn compile && mvn exec:java -Dexec.mainClass="com.google.businesscommunications.businessmessages.samples.AgentSample" -Dexec.args="BRAND_NAME NO-DELETE" | ||
``` | ||
|
||
Replace BRAND_NAME with a valid brand ID in "brands/BRAND_ID" format. | ||
If you haven't created a brand, run the brand sample with the NO-DELETE | ||
argument to create a brand to reference. | ||
Replace BRAND_NAME with a valid brand ID in "brands/BRAND_ID" format. If you haven't created a brand, run the brand sample with the NO-DELETE argument to create a brand to reference. | ||
|
||
* Agent API example without agent deletion: | ||
### Location CRUD operations | ||
|
||
mvn compile && mvn exec:java -Dexec.mainClass="com.google.businesscommunications.businessmessages.samples.AgentSample" -Dexec.args="BRAND_NAME NO-DELETE" | ||
This sample demonstrates how to create a new location, get location details, update the location, list all location, and remove the created location. | ||
|
||
Replace BRAND_NAME with a valid brand ID in "brands/BRAND_ID" format. | ||
If you haven't created a brand, run the brand sample with the NO-DELETE | ||
argument to create a brand to reference. | ||
View the [source code](https://github.com/google-business-communications/bc-bm-java-command-line-examples/blob/master/src/main/java/com/google/businesscommunications/businessmessages/samples/LocationSample.java). | ||
|
||
* Location API example: | ||
Usage: | ||
|
||
mvn compile && mvn exec:java -Dexec.mainClass="com.google.businesscommunications.businessmessages.samples.LocationSample" -Dexec.args="AGENT_NAME" | ||
```bash | ||
mvn compile && mvn exec:java -Dexec.mainClass="com.google.businesscommunications.businessmessages.samples.LocationSample" -Dexec.args="AGENT_NAME" | ||
``` | ||
|
||
Replace AGENT_NAME with a valid agent ID in "brands/BRAND_ID/agents/AGENT_ID" format. | ||
If you haven't created an agent, run the agent sample with the NO-DELETE | ||
argument to create an agent to reference. | ||
Replace AGENT_NAME with a valid agent ID in "brands/BRAND_ID/agents/AGENT_ID" format. If you haven't created an agent, run the agent sample with the NO-DELETE argument to create an agent to reference. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters