403 User is not an active communication on the conversation when reply email

Hi,

I'm trying to reply an email:

new GenesysAPI().PostConversationsEmailMessages(conversationId, emailMessage);

I get token the same way that I do for other services:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11;
CreateCallbackResponse result = new CreateCallbackResponse();
PureCloudPlatform.Client.V2.Client.Configuration.Default.ApiClient.setBasePath(PureCloudRegionHosts.eu_west_1);
var accessTokenInfo = PureCloudPlatform.Client.V2.Client.Configuration.Default.ApiClient.PostToken("MyIdClient", "MySecretClient");

But in this case, I get an ERROR 403 Response:

{
	"message": "User is not an active communication on the conversation.",
	"code": "postino.error.forbidden",
	"status": 403,
	"messageWithParams": "User is not an active communication on the conversation.",
	"messageParams": {},
	"contextId": "0a267f6d-08e9-45bb-be39-d982cd00e86d",
	"details": [],
	"errors": []
}

If I get a token from some call in https://apps.mypurecloud.de/ (Chrome > DevTools > Network) and I hardcode it, then call works correctly.

What am I doing wrong?

Can I please get a response on this?

Thanks.

Hello,

It means that this API Endpoint must be invoked with an access/authorization token associated with a user who is an active participant in the conversation.
I mean that the token you get must be obtained by a user who is an active participant in the conversation - with an OAuth Grant flow like Implicit Grant flow, Authorization Code Grant, PKCE Grant or SAML2 Bearer Grant.

Regards,

I see.

I have been cheking documentation and I found that I must get token by passing Authorization Code, something like this:

var accessTokenInfo = PureCloudPlatform.Client.V2.Client.Configuration.Default.ApiClient.PostToken("myClientId", "mySecret", authorizationCode: "myAuthorizationCode");

But I didn't find an Genesys API service that returns the authorizationCode. I checked users, oauth and authorization services responses.

How can I get the authorizationCode?
Some help would be apreciated.

I think you are missing what OAuth Grant flows and Authorization relate to.

In order to get an access token, you'll select one of the OAuth Grant types (Implicit, Client Credentials, ...).
Requesting a user oriented access token (with implicit, or authorization code, ...) implies that the user will authenticate on a Genesys Cloud Login web page.
You can check this: https://developer.genesys.cloud/authorization/platform-auth/ for more info on the different Grant Types.

Once you have decided which grant type you want to use, you will define/create an OAuth Client with the corresponding Grant Type (Client Credentials, Code Authorization, Token Implicit Grant, ...).

And you will invoke the corresponding OAuth Grant type flow. For Authorization Code, see:

and

Regards,

Thanks for that info, I have been reading and I understand this system a bit more now. But it means to make changes that we may not do.

Is there any way to let any user to reply an email? We need that any user can reply any email at any moment, it includes agents that does not have this email in a queue.

Hello,

As far as I know, the user must be a participant in the conversation to reply.
So it will not be possible with a Client Credentials Grant token - no user context.
For other user oriented grants (Implicit Grant, Authorization Code Grant, ...), the user would first need to retrieve the email (transferring the email from the queue/other user to the user who will be replying).

Regards,

I've created a new Authorization Code Grant Oauth client and uploaded framework.js file with the new client id (replacing the current Implicit Grant that embeddedframework uses).
I set dedicatedLoginWindow to false in the query, to have access to the ?code= at the response.

    <div class="softphone">
      <iframe
        id="softphone"
        class="base-tab"
        allow="camera *; microphone *"
        src="https://apps.mypurecloud.de/crm/embeddableFramework.html?dedicatedLoginWindow=false&enableFrameworkClientId=true"
      ></iframe>
    </div>

Then I login successfully to softPhone, but I don't get the code parameter spected in the query after success login.

How can I get authenticationcode from Genesys Login Page inside embeddable framework softphone iframe?

Can I please get a response on this?

Thanks.

Hello,

You seem to be asking a different question (on Embeddable Framework) than your original one (on Platform API .Net SDK).

The Genesys Embeddable Framework only supports OAuth Implicit Grant (public deployments, private deployments with User.getAuthToken).
In Create an OAuth client page - select "Genesys Cloud Embeddable Framework" tab.

Regards,

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.