Before users can begin conversations with your agent, you need to set your agent's messaging availability in Business Messages.
If a user messages your agent during available hours, your agent greets the user with a welcome message and conversation starters. If the conversation starts outside of available hours, users see the agent's offline message. See Begin the conversation for more information about these messages.
Bot and human availability
You can specify separate bot and human representative availability.
If you have any sort of automation composing messages for your agent—whether the automation is an auto-responder telling users their place in a queue, a complex natural language understanding agent that has dynamic access to user details, or anything in between—specify bot messaging availability.
Human availability is a must if you want to launch an agent on Google-managed entry points, including location-based entry points and non-local entry points (except for Google Ads). For human availability, only specify the days of the week and hours that you have live agents available to answer questions.
If bot representatives are available 24 hours a day but human representatives are available from 8 AM to 8 PM, you can specify those independently.
Additionally, if you specify both bot and human availability, you can send live agent request suggestions to prompt users to request live agents if bot representatives can't fulfill their needs.
Update messaging availability
To update messaging availability, you make a PATCH request with the Business
Communications API to update an agent's primaryAgentInteraction
and
additionalAgentInteractions
fields.
When you update these fields, you must include values for all fields in the
SupportedAgentInteraction object. Update requests overwrite the contents of all
fields you edit, including any child fields. For example, if you make a request
to add an instance to hours
, you need to include all previous hours
instances as well, otherwise your update overwrites them.
Prerequisites
Before you update messaging availability, you need the following items:
- Path to your GCP project's service account key on your development machine
The agent
name
(for example, "brands/12345/agents/67890")If you don't know the agent's
name
, see List all agents for a brand.Bot availability timezones, days of the week, and hours
Human availability timezones, days of the week, and hours
If you don't know the current primaryAgentInteraction
and
additionalAgentInteractions
values, see Get agent
information.
Send the update request
To update the agent, run the following command. Replace variables with values you identified in Prerequisites.
If you have both bot and human messaging availability, specify bot availability
in primaryAgentInteraction
and human availability in an instance of
additionalAgentInteractions
.
Bot and human
# This code updates the agent interaction of a bot and human representatives. # Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/brands.agents/patch # Replace the __BRAND_ID__ and __AGENT_ID__ # Make sure a service account key file exists at ./service_account_key.json curl -X PATCH \ "https://businesscommunications.googleapis.com/v1/brands/__BRAND_ID__/agents/__AGENT_ID__?updateMask=businessMessagesAgent.primaryAgentInteraction,businessMessagesAgent.additionalAgentInteractions" \ -H "Content-Type: application/json" \ -H "User-Agent: curl/business-communications" \ -H "$(oauth2l header --json ./service_account_key.json businesscommunications)" \ -d '{ "businessMessagesAgent": { "primaryAgentInteraction": { "interactionType": "BOT", "botRepresentative": { "botMessagingAvailability": { "hours": [ { "startTime": { "hours": 20, "minutes": 0 }, "endTime": { "hours": 8, "minutes": 0 }, "timeZone": "America/Los_Angeles", "startDay": "MONDAY", "endDay": "SUNDAY" } ] } } }, "additionalAgentInteractions": [ { "interactionType": "HUMAN", "humanRepresentative": { "humanMessagingAvailability": { "hours": [ { "startTime": { "hours": 8, "minutes": 0 }, "endTime": { "hours": 20, "minutes": 0 }, "timeZone": "America/Los_Angeles", "startDay": "MONDAY", "endDay": "SUNDAY" } ] } } } ] } }'
Bot-only
# This code updates the primary agent interaction of a bot representative # Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/brands.agents/patch # Replace the __BRAND_ID__ and __AGENT_ID__ # Make sure a service account key file exists at ./service_account_key.json curl -X PATCH \ "https://businesscommunications.googleapis.com/v1/brands/__BRAND_ID__/agents/__AGENT_ID__?updateMask=businessMessagesAgent.primaryAgentInteraction" \ -H "Content-Type: application/json" \ -H "User-Agent: curl/business-communications" \ -H "$(oauth2l header --json ./service_account_key.json businesscommunications)" \ -d '{ "businessMessagesAgent": { "primaryAgentInteraction": { "interactionType": "BOT", "botRepresentative": { "botMessagingAvailability": { "hours": [ { "startTime": { "hours": 20, "minutes": 0 }, "endTime": { "hours": 8, "minutes": 0 }, "timeZone": "America/Los_Angeles", "startDay": "MONDAY", "endDay": "SUNDAY" } ] } } } } }'
Human-only
# This code updates the primary agent interaction of a human representative # Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/brands.agents/patch # Replace the __BRAND_ID__ and __AGENT_ID__ # Make sure a service account key file exists at ./service_account_key.json curl -X PATCH \ "https://businesscommunications.googleapis.com/v1/brands/__BRAND_ID__/agents/__AGENT_ID__?updateMask=businessMessagesAgent.primaryAgentInteraction" \ -H "Content-Type: application/json" \ -H "User-Agent: curl/business-communications" \ -H "$(oauth2l header --json ./service_account_key.json businesscommunications)" \ -d '{ "businessMessagesAgent": { "primaryAgentInteraction": { "interactionType": "HUMAN", "humanRepresentative": { "humanMessagingAvailability": { "hours": [ { "startTime": { "hours": 20, "minutes": 0 }, "endTime": { "hours": 8, "minutes": 0 }, "timeZone": "America/Los_Angeles", "startDay": "MONDAY", "endDay": "SUNDAY" } ] } } } } }'
For formatting and value options, see
brands.agents.patch
and
SupportedAgentInteraction
.