Dan_Fontaine | 2020-10-14 22:13:09 UTC | #1
I am using the API explorer to test creating an inbound email that routes to a flow. The flow is to send an auto-reply. It does not when I use the API, it does route to the queue. Here is the Request body that I am sending: { "queueId": "", "flowId": "my flow ID is inserted here", "provider": "Test", "skillIds": [], "languageId": "", "priority": 0, "attributes": {}, "toAddress": "", "toName": "", "fromAddress": "my email address is inserted here", "fromName": "", "subject": "TEST EMAIL MESSAGE", "direction": "INBOUND", "htmlBody": "<p>Test message<p/>", "textBody": "TEST EMAIL MESSAGE" }
What am I doing incorrectly?
Jerome.Saint-Marc | 2020-10-15 08:21:37 UTC | #2
Hello,
What you are creating with your request is in fact a "3rd party email" It is not a real Genesys Cloud Inbound ACD E-mail.
You could consider it as a task/workitem having a mediaType email (for Agent utilization, for Architect Email flow perspectives). But its content is not available as it would be for a real Genesys Cloud Inbound ACD E-Mail, and you cannot send an email reply to it (Auto-Reply in Architect flow, or Reply at Contact Center Agent level).
See some info here: https://developer.mypurecloud.com/api/rest/v2/conversations/third-party-object-routing.html
And here: https://developer.mypurecloud.com/api/rest/v2/conversations/#post-api-v2-conversations-emails "If the direction of the request is INBOUND, this will create an external conversation with a third party provider. If the direction of the the request is OUTBOUND, this will create a conversation to send outbound emails on behalf of a queue."
Only a user (someone signed-in with user level credentials, like implicit grant or authorization code grant) can start a new Genesys Cloud E-mail interaction, and only on behalf of a Queue. This is similar to what can be done from the Genesys Desktop UI when trying to generate an email out. -> direction: OUTBOUND, (provider: "PureCloud Email"), queueId: ID if the Queue used as "on behalf of"
For "INBOUND" emails, it can only be "3rd party emails". -> You can't use provider: "PureCloud Email" on such request (reserved). A user (user level credentials) or an application (using Client Credentials grant) can submit a request for an "INBOUND" e-mail, coming from an external provider. But this interaction will be managed as a 3rd party email (i.e. workitems of type email) - for which Send Auto-Reply from Architect flow, or display and reply as a native Genesys Cloud ACD Email for a Contact Center Agent, are not available.
If you want to submit emails to Genesys Cloud, so they are managed as ACD e-mails (having access to Auto-Reply in the Architect flow, Contact Center Agent able to send a reply, ...), you would have to do this via a 3rd party SMTP server (sending an email via this 3rd party Email/SMTP server to the Genesys Cloud E-mail address).
Regards,
Dan_Fontaine | 2020-10-15 13:50:03 UTC | #3
Thank you for the explanation. I appreciate the time you took to provide the information regarding this as the documentation is a bit sparse (at least what I could find).
Honestly, what I am trying to do is send an agentless email using the API in a data action. Similar to sending an agentless message (SMS).
Is it possible, using another API to send an agentless email?
Jerome.Saint-Marc | 2020-10-15 15:33:09 UTC | #4
Hello,
No it is not possible to send agentless email. You can do this only with SMS at this time.
You would have to submit the email via an SMTP server.
Regards,
Stan | 2020-10-30 09:13:57 UTC | #5
Jerome.Saint-Marc, post:2, topic:9076
Only a user (someone signed-in with user level credentials, like implicit grant or authorization code grant) can start a new Genesys Cloud E-mail interaction, and only on behalf of a Queue.
Now I call this API( #post-api-v2-conversations-emails using client credentials grant and it returns 400 (not.a.user). Both of the grant ways you mentioned above require manual login. Is there any way to invoke this API without requiring a munual login action ?
Regards
Jerome.Saint-Marc | 2020-10-30 09:28:55 UTC | #6
Hello,
When using client credentials grant (i.e. without manual login), you can only call this API to create a 3rd party email [direction: INBOUND, provider: Custom 3rd Party Email, queueId: ID of the queue where the interaction will be queued].
With client credentials grant, you can't create a Genesys Cloud Email (Inbound or Outbound).
If you need to generate e-mails from a server-side application to Genesys Cloud, or to other destinations, you will have to leverage a 3rd party SMTP server (SMTP/Mail service).
Regards,
Stan | 2020-11-02 12:43:23 UTC | #7
I was able to complete the authorization code grant via HTTP request, but it suddenly doesn't work now? The http request steps are as follows:
- GET:https://login.mypurecloud.jp/oauth/authorize?response_type=code&client_id={clientId}&redirect_url=
{redirectUrl}
- POST:https://login.mypurecloud.jp/login
- PUT: https://login.mypurecloud.jp/request/{rid}
(authorization code can be obtained from the returned "redirect" field)
But now step 3 returns 400, why?
Jerome.Saint-Marc | 2020-11-03 10:37:41 UTC | #8
Hello,
I am not sure I understand what you are trying to do. Are you trying to simulate the login process via code (Authentication & OAuth2 part)? If that's the case, it is not allowed. The login part (where user will enter credentials on Genesys Cloud page) is to be accessed via a web client (Web browser, Windows Form/Web Component in C#, ...).
Moreover, the use of Authorization Code Grant flow implies that you have a backend server involved and serving web pages/requests.
I mean that the user is trying to access 'https://login.mypurecloud.jp/oauth/authorize?client_id=<my-client-id>&response_type=code&redirecturi=<https://example.com/oauth/callback>' (using a Web browser, using a Windows Forms or Web Component in a C# application, ...). If there is no active token, the user will be prompted on the Genesys Cloud Login web page to enter and to submit his credentials. If the user is authenticated successfully, he will be redirected to the URL specified in redirecturi (and defined in the OAuth client - Allowed URLs) with an authorization code provided in the query parameters. I mean: https://example.com/oauth/callback?code=my-authorization-code
The example.com url corresponds to a page/url that your backend server is managing. The backend extract the authorization code (from the code query parameter). It can then request a token from Genesys Cloud using a POST https://login.mypurecloud.jp/oauth/token The backend can then use this token in order to send Platform API requests on behalf of the user.
Regards,
system | 2020-12-04 10:46:20 UTC | #9
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 9076