I'm working through an Open Messaging tutorial here: (/articles/get-started-with-open-messaging/)
I've created a messaging integration, but can't create the agentless outbound message required to start an Open Messaging conversation. I'm using this request: https://developer.genesys.cloud/routing/conversations/conversations-apis#post-api-v2-conversations-messages-agentless
with the following body:
{
"fromAddress": "39fbc29f-3760-4e97-98f1-22d4e2d3960a",
"toAddress": "messaging-user@externalservice.com",
"toAddressMessengerType": "open",
"textBody": "Outbound message text!",
"useExistingActiveConversation": false
}
where the fromAddress is my integration ID.
It doesn't allow me to execute the request without assigning an account, but when I do I get the following message: "The request failed with response code: 400. Message: This request requires a non-user context. User token cannot be used for requests to this resource."
So a Catch 22!
Can anyone help and / or suggest a better tutorial? Thanks
Hello,
The POST /api/v2/conversations/messages/agentless endpoint requires a token obtained via an OAuth Client Credentials Grant flow.
This is stated in the endpoint description: "... Send an agentless (api participant) outbound message using a client credential grant. In order to call this endpoint you will need OAuth token generated using OAuth client credentials authorized with at least messaging scope. ..."
The OUuth Client Credentials Grant client needs to have a role assigned with "conversation:message:create" permission (at least).
Regards,
Hi Jerome, thanks for the quick response. So, do I copy the Client Secret from the Oauth client and add it to the integration Outbound Notification Webhook Signature Secret Token field?
I tried that and in Postman I'm getting "Invalid login credentials", in the dev environment I'm still getting the same message. How do I associate the Oath client I created with the Open Messaging Integration I created?
Hello,
There is no link between the OAuth Client (Client Credentials Grant) and the Open Messaging Integration.
There is no need to.
The "Outbound Notification Webhook Signature Secret Token" that you set on your Open Messaging platform/integration has nothing to do with the OAuth ClientId and ClientSecret. It is a key you will define via the Genesys Desktop - Admin UI for your platform.
When messages are sent to the webhook url, you will be able to validate the signture (using the token you had set in Genesys Desktop Admin for your open messaging platform).
See Validate Webhook notifications for more info.
The access/bearer token obtained via the OAuth Client Credentials Grant flow is used so you can send to send an inbound message to Genesys Cloud (or trigger an Agentless Message Conversation) just like any other Platform API endpoints (header Authorization: Bearer YOU_TOKEN).
To send a message from "customers" - i.e. from your server to Genesys Cloud.
This would correspond to messages sent by a customer on instagram/FB/... that you catch on your server, with your own connections to these social networks, and that you want to "forward/send" to Genesys Cloud.
You would use: POST /api/v2/conversations/messages/inbound/open . (see Send an inbound open message).
To have Genesys Cloud send a message to your server (to be forwarded to ...), without involving an Agent, this would be with POST /api/v2/conversations/messages/agentless.
This one could be used if you want to trigger a message from an Architect flow via a Data Action.
The link with the Open Messaging platform (and the webhook url) is made via the IntegrationId that you provide in the request body of these 2 API endpoints.
There is a video which was made a while ago: DevCast Tutorial 18 | Introduction to the Genesys Cloud Open Messaging API - YouTube
And its code: open-messaging-blueprint/blueprint at main · GenesysCloudBlueprints/open-messaging-blueprint · GitHub
Also, here is a blueprint that may help: https://developer.genesys.cloud/blueprints/slack-open-messaging-blueprint/
Regards,
Thanks Jerome, I'll have a look through this lot, but seems like I have everything I need. The tutorial here, Get started with open messaging - Genesys Cloud Resource Center, seems to be missing some crucial steps