When you register as a partner with Business Messages, you can enable conversations between users and brands by creating agents—conversational entities that represent business functions, such as website support, and brand locations.
When a user finds a brand that you manage in Google Search or Google Maps, the search results display a Chat option. When the user clicks Chat, they can send messages to the brand's agent. The agent lets you receive and respond to the user's messages.
Register as a partner
By registering as a partner with Business Messages, creating agents for brands, and leveraging the APIs that power your agent, you can enable messaging experiences for customer services, sales, and other business applications.
- Open the Business Communications Developer Console.
- Under Business Messages, click Create partner account.
Enter values for your partner information:
Field Value Your name Your full name Partner name Your organization's name Partner website Your organization's website Region The region you want to host the Business Messages service
Review and accept the Business Messages Terms of Service.
Click Create.
You are now registered as a Business Messages partner and have access to the Business Messages and Business Communications APIs. The Business Messages API sends messages to users, while the Business Communications API manages agents.
Create a service account
To securely authenticate API calls to the Business Messages and Business Communications APIs, you need a service account key and the oauth2l command line tool.
- On the Business Communications Developer Console home page, click Partner account settings.
- In the left navigation, click Service account.
Click Create key, then click Create.
Your browser downloads the service account key. Store your service account key in a secure, private location. Don't share your key publicly. You will need this key later to access the Business Message and Business Communication APIs.
Set your webook
Now that the Business Messages and Business Communications API is enabled, you must specify your webhook URL to start receiving messages.
- Open the Account settings in Business Communications Developer Console.
- Make sure the correct partner account is selected.
- For Business Messages webhook URL, click Configure.
- For Webhook endpoint URL, enter your webhook's URL, beginning with "https://".
- Note your
clientToken
value. You need it to verify that messages you receive are coming from Google. Configure your webhook to accept a
POST
request with the specifiedclientToken
parameter and send a200 OK
response with the plain text value of thesecret
parameter as the response body.For example, if your webhook receives a
POST
request with the following body content{ "clientToken":"SJENCPGJESMGUFPY", "secret":"0123456789" }
your webhook should confirm the
clientToken
value and, ifclientToken
is correct, return a200 OK
response with0123456789
as the response body.In the console, click Verify.
When Business Messages verifies your webhook, the dialog closes.
See Example: Update webhook URL to see how to configure your webhook with the Business Communication APIs.
Get partner information
To get your current partner information, you can query the Business Communications API with your Partner ID.
Run the following command. Replace PARTNER_ID with your Partner ID.
# This code gets the partner. # Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/partners/get # Replace the __PARTNER_ID__ # Make sure a service account key file exists at ./service_account_key.json curl -X GET \ "https://businesscommunications.googleapis.com/v1/partners/__PARTNER_ID__" \ -H "Content-Type: application/json" \ -H "User-Agent: curl/business-communications" \ -H "$(oauth2l header --json ./service_account_key.json businesscommunications)"
Update partner information
To update your partner information, you can use the Account settings page in Business Communications Developer Console or run the following commands.
Replace PARTNER_ID with your Partner ID(Partner ID can be found in Business Communications Developer Console), and replace UPDATED_FIELDS with the field names you update.
# This code updates the partner entity. # Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/partners/patch # Replace the __PARTNER_ID__, __UPDATED_FIELDS__, __FIELD_NAME__, __FIELD_VALUE__ # Make sure a service account key file exists at ./service_account_key.json curl -X PATCH \ "https://businesscommunications.googleapis.com/v1/partners/__PARTNER_ID__?updateMask=__UPDATED_FIELDS__" \ -H "Content-Type: application/json" \ -H "User-Agent: curl/business-communications" \ -H "$(oauth2l header --json ./service_account_key.json businesscommunications)" \ -d '{ "__FIELD_NAME__": "__FIELD_VALUE__" }'
For formatting and value options, see
partners.patch
.
Example: Update display name
curl -X PATCH \ "https://businesscommunications.googleapis.com/v1/brands/12345/partners/67890?updateMask=displayName" \ -H "Content-Type: application/json" \ -H "User-Agent: curl/business-communications" \ -H "$(oauth2l header --json /path/to/service/account/key businesscommunications)" \ -d "{ 'displayName': 'XYZ Messaging', }"
Example: Update webhook URL
curl -X PATCH \ "https://businesscommunications.googleapis.com/v1/partners/12345?updateMask=productCapabilities" \ -H "Content-Type: application/json" \ -H "User-Agent: curl/business-communications" \ -H "$(oauth2l header --json /path/to/service/account/key businesscommunications)" \ -d "{ 'productCapabilities': [ { 'product': 'BUSINESS_MESSAGES', 'businessMessagesCapability': { 'webhookUrl': 'https://xyz.messaging.com/webhook', }, }, ], }"
Next steps
Now that you're a registered partner and have enabled the APIs, you can start developing with Business Messages. To get started quickly, see Create your first agent.
Otherwise, learn how to create agents to represent your brands in conversations and configure your webhook to receive messages from users.