AI-generated Key Takeaways
-
Agents can send messages to users using a POST request to the
/v1/{parent=conversations/*}/messages
endpoint. -
Sending a message requires the
parent
parameter, specifying the conversation ID. -
An optional
forceFallback
query parameter can be used by unlaunched agents to send fallback text. -
Successful requests return a newly created
Message
instance in the response body. -
Authorization requires the
https://www.googleapis.com/auth/businessmessages
OAuth scope.
Sends a message from an agent to a user. If a conversation doesn't exist or an agent tries to send a message in a conversation that it isn't authorized to participate in, returns a PERMISSION DENIED
error.
HTTP request
POST https://businessmessages.googleapis.com/v1/{parent=conversations/*}/messages
The URL uses gRPC Transcoding syntax.
Path parameters
Parameters | |
---|---|
parent |
Required. The conversation that contains the message. Resolves to "conversations/{conversationId}". |
Query parameters
Parameters | |
---|---|
forceFallback |
Optional. A flag to send the specified fallback text instead of other message content. Only available to agents that aren't launched. If the flag is true and fallback text isn't specified, Business Messages returns an error. |
Request body
The request body contains an instance of Message
.
Response body
If successful, the response body contains a newly created instance of Message
.
Authorization scopes
Requires the following OAuth scope:
https://www.googleapis.com/auth/businessmessages
For more information, see the OAuth 2.0 Overview.