Integrations and Actions

Genesys Cloud and Mindful integration guide supplement

In Genesys Cloud, you will need two Integrations, which you can think of as containers to hold Actions. The Actions within the Integrations will allow you to interact with data from the Mindful and Genesys environments in several ways:

  • Checking the EWT in Genesys Cloud

  • Requesting a callback-offer decision from Mindful via API

  • Posting and retrieving user data from Mindful Datastore

  • Sending an Agent Answer event to Mindful via API

This section will describe the process of setting up the required Integrations and Actions in Genesys Cloud.

See below for more details on the Actions:

  • Get EWT queries the Genesys public API using OAuth credentials to retrieve the Estimated Wait Time for the specified queue.

  • Get OAuth Token requests a temporary access token to authenticate requests to the Mindful API.

  • Get Offer Decision requests an indication of whether or not to send a caller to Mindful to receive an offer of a callback.

  • Post to Datastore is invoked by the inbound Architect Flow to send user data to Mindful Datastore via HTTPS POST.

  • Agent Answer sends an answer event to Mindful to indicate that the agent is on the line and ready to connect to a customer.

  • Retrieve from Datastore is used by the Choose Hold and Callback Architect Flows to retrieve the user data from Mindful Datastore via HTTPS GET.

Two OAuth client Integrations are needed for different Actions — one for Genesys Cloud authentication and another for Mindful authentication.

Create an OAuth Client for the Genesys Cloud Integration

For an Integration and the Actions within it to use the Genesys Cloud APIs, the Integration must have the necessary permissions. To grant those permissions, you must first create an OAuth client.

  1. On the OAuth page (Admin > Integrations > OAuth), click Add Client.

    oauth settings
  2. On the Client Details tab, enter an App Name.

  3. Select "Client Credentials" in the Grant Types section.

    client details

    The Roles tab will appear after selecting this option.

  4. On the Roles tab, assign a role that provides the permissions that will be required by the Integration/Action for Genesys Cloud.

    The Routing > Queue > View permission is required to query the Estimated Wait Time, and this permission is only granted to the Master Admin role by default.

    roles

    You can apply the Master Admin role to the OAuth client or add the required permission to another role you wish to use.

    permissions

Create an OAuth Client for the Mindful API

You will need an OAuth integration to use Mindful APIs, such as Agent Answer and Get Offer.

  1. On the Integrations page (Admin > Integrations > Integrations), click + Integrations.

  2. Locate the Web Services Data Actions tile, then click Install.

    image of the web services data actions tile
  3. On the configuration page that appears, enter a name on the Details tab, then open the Configuration tab.

  4. In the Configuration tab, open the Credentials sub-tab, then click Configure.

    image of the credentials tab
  5. Configure credentials as shown below:

    image of the configure credentials window
    • Credential Type — Select "User Defined (OAuth)".

    • Credential Fields — Add the four fields listed below:

      • LoginUrl — Enter the Authentication endpoint for the Mindful API.

      • clientId — Enter a Client ID from a Mindful Application Client.

      • clientSecret — Enter a Client Secret from a Mindful Application Client.

      • scope — Enter mindful-api/callback.metric.read mindful-api/callback.status.read.

        The scope is needed for the Get Offer API endpoint only.

    Click OK when finished.

  6. Back on the Integrations page, toggle the Active/Inactive switch to "Active".

Integration for Genesys Cloud

This Integration will serve as a container to hold the Action that will retrieve EWT from Genesys Cloud.

Note:

You may already have a Genesys Cloud Data Action Integration configured if you make any Genesys Cloud API calls elsewhere in the environment. If that is the case, the GetEWT Action should already be present, since it is generated by default when a Genesys Cloud Data Action Integration is deployed. The steps in this section assume that the Integration and Action do not already exist.

  1. On the Integrations page (Admin > Integrations > Integrations), click + Integrations.

  2. Locate the Genesys Cloud Data Actions tile, then click Install. After installation, you should see the configuration page shown below:

    genesys cloud data actions
  3. On the Details tab, enter a name for the Integration in the Name field.

  4. On the Configuration tab, open the Credentials sub-tab and make sure the OAuth client you created previously is selected.

    credentials
  5. Save your changes and set the Integration to Active when finished.

Verify the Get Estimated Wait Time Action exists

When a new Genesys Cloud Data Action Integration is created, default Data Actions are created for that Integration automatically. One of the default Actions is Get Estimated Wait Time, which will be used in the inbound Architect Flow.

To verify this Action is present in the new Integration, open the Actions page and look for Get Estimated Wait Time. Click the name of the Action to open it:

get estimated wait time action

There should be no need to change anything in this Action. Once published, it will be ready for use by the inbound Flow.

Important:

The Genesys Cloud API that retrieves the Estimated Wait Time is subject to a hard limit of 300 API requests per minute for each Genesys Cloud organization. This API is also shared with other Genesys Cloud Platform API methods, such as updating Genesys Cloud Data Tables, and this needs to be considered when implementing the integration with Mindful Callback.

If there is a risk of exceeding the API limit, the Mindful team may suggest alternative methods to represent the EWT. In such a scenario, it may not be necessary to create the Genesys Cloud Data Actions Integration.

Integration for Mindful

Just as you did for Genesys Cloud Actions, you will first need to create an Integration to hold Actions related to Mindful.

  1. On the Integrations page, click the + Integrations button near the top right of the page.

  2. Find the tile named Web Services Data Actions, then click Install in that tile. After installation, you should see the configuration page shown below:

    Mindful integration
  3. On the Details tab, enter a name for the Integration in the Name field.

  4. Save your changes and set the Integration to Active when finished.

Get Access Token Action

This Action will send a request to the Mindful OAuth credentials API endpoint to obtain a temporary (one hour) access token for subsequent API requests.

  1. On the Integrations page, open the Actions tab.

  2. Click Add Action.

  3. When prompted, select the Integration created earlier for Mindful OAuth credentials, enter a name such as "Get Access Token", then click Add.

    example of selecting an integration
  4. Open the Setup tab and add a string variable named "access_token" in the Output Contract section.

    example action contracts
  5. Open the Configuration sub-tab and verify that "Raw Request (string)" is shown under Available Inputs and "access_token (string)" is shown under Available Outputs.

    example action configuration
  6. Open the Test sub-tab, then click Run Action to send a test request.

    If a token is returned and assigned to the access_token variable, the test has succeeded.

    example test
  7. Click Save & Publish when complete.

    On the Integrations page, the Action should now show "Published" in the Status column.

Get Offer Decision Action

Next, you'll need an Action to send a request to the Retrieve callback offer decision attributes API endpoint.

  1. Click Add Action on the Actions tab of the Integrations page to begin.

  2. In the Integration Name field, select the Integration used for other Mindful-related Actions, as described in the main Genesys Cloud integration guide.

  3. Enter a name for the Action, then click Add.

  4. Open the new Action, then open the Setup tab.

  5. Add the following two strings to the Input Contract Schema:

    • CallTarget_URL

    • AuthToken

    example action contracts
  6. In the Output Contract, add the following nested Object as the Response:

    { "title": "OfferResponse", "type": "object", "properties": { "data": { "type": "object", "properties": { "id": { "type": "integer" }, "shouldOffer": { "type": "boolean" }, "isEndOfDay": { "type": "boolean" }, "afterHours": { "type": "boolean" }, "registrationEnabled": { "type": "boolean" }, "offeringAsap": { "type": "boolean" }, "offeringScheduleVoice": { "type": "boolean" }, "offeringScheduleWidget": { "type": "boolean" }, "offeringChooseHold": { "type": "boolean" }, "offeringTextIntercept": { "type": "boolean" }, "offeringNextDay": { "type": "boolean" }, "availableTimeslots": { "type": "boolean" }, "estimatedCallbackTime": { "type": "integer" } }, "additionalProperties": true } }, "additionalProperties": true }
  7. Verify that the Output Contract contains all of the properties included in the JSON object, as shown below:

    example output contract
  8. Open the Configuration sub-tab, still within the Setup tab.

  9. On the right side of the page, verify that the expected inputs are available:

    • Available Inputs:
      • CallTarget_URL (string)
      • AuthToken (string)
      • Raw Request (string)
    • Available Outputs:
      • data (object)
    example action configuration
  10. Open a new browser tab and run a new test of the Token Retrieval Action, then copy the token that is returned.

  11. Back on the Get Offer Action, open the Test sub-tab and paste the new token into the AuthToken field.

  12. Enter the Offer Decision endpoint URL in the CallTarget_URL field, including your Call Target ID.

    Note: To obtain your Call Target ID, see the documentation for the Retrieve all Call Targets endpoint. To obtain the Get Offer endpoint URL, see the documentation for the Retrieve callback offer decision attributes endpoint.
  13. Execute the test after entering the required information.

    example input contract
  14. Verify that the results contain all of the return values expected for the offer-decision API endpoint:

    example of a successful test
  15. Click Save & Publish after a successful test.

  16. Lastly, verify that the newly created Action shows "Published" in the Status column of the Actions tab.

Datastore Post Action

The Datastore Post Action will define the fields that are populated from the inbound Flow. These include mandatory fields used for the HTTPS POST (the Mindful Datastore URL and Dataset Template API Token). You can include additional fields to pass custom data from the initial inbound call to the return call (account number, original call ID, etc.) as well.

After defining the necessary fields, the Action will send a POST to the Datastore API to store user data for each call.

Note:

The Datastore Post and Get Actions are only required if you need to pass custom data from the inbound call to the return call (choose hold or callback).

Follow the instructions below to Create the Datastore Post Action.

  1. Open Admin > Integrations > Actions.

  2. Click Add Action to begin.

  3. In the modal window that appears, enter a name for the Action (such as Datastore POST).

  4. Select the Integration for Mindful created earlier.

    integration selector
  5. Click Add to create the new Action.

  6. In the Setup tab for the Action, open the Input Contract.

  7. Create an object (named PostData in the example) and add the necessary data fields within it. These fields will appear in the Architect Flow to pass values into the Action.

    The example below shows the three mandatory fields DS_URL, DS_Auth, and DS_ContactNumber. The example also includes several custom data fields, each of which match a field in the Data Set Template in Mindful Datastore.

    action contracts
  8. Next, open the Configuration tab in the sidebar (still in the Setup tab).

    action configuration
  9. Configure this tab as seen in the example:

    • Request type — Select "POST".

    • Request URL Template — Enter the name of the datastore URL field configured on the Contracts page (in the format ${input.<fieldname>}). In our example, we use ${input.DS_URL}.

    • Add two entries in the Headers section:

      • Authorization — Enter the name of the datastore Authorization field configured on the Contracts page (in the format ${input.<fieldname>}). In our example, we use ${input.DS_Auth}.

      • Content-type — Enter application/json.

    • Request Body Template — Enter a JSON object containing the variables that will be mapped to the required fields in the Data Set Template.

      The structure of the Request Body Template string must be precise. You can copy a template of the required object for a particular Data Set Template in the Mindful Datastore UI at Data Set Templates > Data Set API, as seen below:

      data set A.P.I. example

      Alternatively, you can copy the example object below and make changes as needed for your particular data set.

      {"customer_contact_number":"${input.DS_ContactNumber}","data_values":{"FirstName":"${input.DS_FirstName}","LastName":"${input.DS_LastName}","AccNum":"${input.DS_AccNUm}","Callid":"${input.DS_Callid}"}}

Test the Action

Follow the steps below to test the new Action:

  1. Open the Test tab.

  2. Enter test values for each field, then click Run Action. You should receive a 200 response if the POST was successful.

  3. If you receive a successful response, look up the data in the Mindful Datastore UI by using the customer contact number as the search key. If all of your test data is present, the Action is working as expected.

Save and publish the Action when finished.

Troubleshooting

Below are common errors you may receive when testing the Datastore Post Action, along with potential remedies.

Error messageCause and solution
Resolve request body template: Processing the Request Body Template resulted in invalid JSON.The JSON object template configured for the Action may not be formatted correctly. Check the format precisely for any discrepancies.
Execute: No authentication bearer token specified in authorization header.This does not necessarily mean that you are missing an auth token. It could mean that your auth token is incorrect or improperly formatted.

Agent Answer Action

This Action will invoke an answer event in Mindful, which provides a critical data point for calculating performance metrics.

Follow the steps below to configure this Action.

  1. On the Integrations page, open the Actions tab.

  2. Click Add Action.

  3. When prompted, select the Integration created earlier for Mindful Data Actions (not the OAuth Integration), enter a name such as "Send Agent Answer", then click Add.

    example integration configuration
  4. Open the Setup tab and add the following string variables as properties of the base object in the Input Contract section:

    example input contract
    • ani — Not Required

    • Authentication — Required

    • queueId — Not Required

    • agentId — Not Required

  5. Open the Configuration sub-tab and configure the provided fields as shown below:

    action configuration
    • HTTP Method — Select "POST".

    • Request URL Template — Enter the Agent Answer API endpoint URL.

      See Mindful API v2 or contact the Mindful team for the URL.

    • Header — Add two headers:

      • Authorization = "$input.Authentication"

      • content-type = "application/json"

    • Request Body Template — Enter the following JSON template:

      { "data": { "ani": "${input.ani}", "metadata": { "queueId": "${input.queueId}", "agentId": "${input.agentId}" } } }
  6. Obtain a new Mindful OAuth access token for testing.

  7. Open the Test sub-tab of the Agent Answer Action.

  8. Enter a valid E.164 phone number and the new access token in the fields provided, then click Run Test.
    Note: Since the phone number is not currently registered for a callback, you will receive a 404 error response, which indicates success at this point. A 404 response indicates that the API request was sent and a response received.
  9. Click Save & Publish when finished.

Datastore Get Action

The Datastore Get Action will retrieve data in the callback-return or choose-hold Flows that was posted for an interaction in the inbound Flow.

This Action defines the fields to expect in the response from Mindful Datastore. These fields include the required parameters (Datastore URL and Auth Token), as well as any custom fields included in your Data Set Template.

Use the following steps to configure the Get Action:

  1. Open Admin > Integrations > Actions.

  2. Click Add Action to begin.

  3. In the modal window that appears, enter a name for the Action (such as Datastore Get).

  4. Select the Integration for Mindful created earlier.

  5. Click Add to create the new Action.

  6. In the Setup tab for the Action, open the Input Contract.

  7. Create an object and add the necessary data fields (DS_URL and DS_Auth) within it. These fields will appear in the Architect Flow to pass values into the Action.

  8. Next, open the Output Contract.

  9. Add all of the fields configured in your Data Set Template in Datastore, exactly as they are defined.

  10. Once added, click Configuration on the left to open the Action configuration page.

    action configuration
  11. Configure the Action as shown:

    • Request type — Select "GET".
    • Request URL Template — Enter the name of the datastore URL variable configured in the previous Contracts page. This should be in the format ${input.<fieldname>}.
    • Add one entry in the Headers section:
      • Authorization — Enter the name of the datastore Authorization field configured on the Contracts page (in the format ${input.<fieldname>}). In our example, we use ${input.DS_Auth}.

Unlike the POST action, no body text is required for the GET Action.

Again this can be tested using the Test page, entering some test data into the fields that match a data set previously posted to Mindful Datastore. Once satisfied with the configuration, save and publish the Action.

To continue configuring the integration, return to the Genesys Cloud and Mindful integration guide.