Genesys Cloud - Using the Mindful GetOffer API

Update the Genesys Cloud integration to use the Mindful API.

This guide updates the Genesys Cloud and Mindful integration guide to use the Retrieve callback offer decision attributes endpoint of the Mindful API to determine whether to send inbound calls to Mindful. This endpoint returns data to help you make an informed decision for call routing, including a boolean shouldOffer KVP. As with the main integration guide, the configuration, Architect Flows, and Actions described here are examples that may be used as templates for integrating with Mindful.

Overview

This guide covers the following topics:

  • Definitions and acronyms
  • OAuth Integration
  • Data Actions
    • Token Retrieval
    • Get Offer Decision
  • Inbound Architect Flow

Definitions and acronyms

TermDescription
APIApplication Programming Interface – a set of functions that allows applications to perform requests against the application providing the API
ECBTEstimated Callback Time as calculated by Mindful Callback that can be used in place of the Genesys Cloud calculated wait time to make routing decisions
JSONJavaScript Object Notation - a lightweight format for storing and transporting data
Mindful CallbackPart of the Mindful platform that provides the capability to request and receive callbacks
Mindful APIA feature of Mindful that allows Call Target status to be requested via API from third-party applications/platforms via Application Client Credentials
shouldOfferThe variable that will be analyzed in order to make a decision in the Flow on whether to route a call to Mindful or Transfer to agents

Integrations

You will need an OAuth Integration to authenticate with the Mindful API via the Data Action that will be created later.

Important: You will need a second Integration to house the Get Offer Data Action, and that Integration is covered in the main Genesys Cloud integration guide.

Creating an OAuth Integration

Admin > Integrations > Integrations

  1. Click +Integration, then locate the Web Services Data Actions tile.

  2. Click Install on the tile.

    image of the web services data actions tile
  3. Enter a name on the Details Tab, then open the Configuration tab.

  4. Select the Credentials sub-tab on the left, then click Configure.

    image of the configuration tab
  5. In the Credentials Type drop-down menu, select User Defined (OAuth).

  6. Enter the following four Credential Fields, and contact the Mindful Solution Delivery team for the values:
    • loginUrl

    • clientId

    • clientSecret

    • scope

    image of the configure credentials window
  7. Return to the Integrations page and set the toggle switch in the Status column to Active.

Data Actions

Two Data Actions are needed for this integration. The first will retrieve a temporary access token required for the Mindful API. The second will send a request to the API after a token has been obtained.

Token Retrieval

Admin > Integrations > Actions

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

  2. In the Integration Name field, select the OAuth Integration created in the previous section.

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

    example of selecting an integration for the actionexample of naming the action
  4. On the Setup tab, add a string named "access_token" to the Output Contract Schema.

    This string will be assigned the value of the temporary token returned from the Mindful Authentication endpoint. The token can then be used in a later Action.

    image of action contracts
  5. Open the Configuration sub-tab, still within the Setup tab.

  6. On the right side of the page, verify that the Available Inputs include "Raw Request (string)" and the Available Outputs include "access_token (string)".

    example action configuration
  7. Open the Test sub-tab, then click Run Action.

    You should see a token returned if the test succeeds.

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

  9. Lastly, verify that the newly created Action shows “Published” in the Status column of the Actions tab.

Get Offer Decision

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.

Inbound Architect Flow

This guide assumes that you will update the existing Inbound Architect Flow detailed in the main Genesys Cloud integration guide. To utilize the new Data Actions created in the previous section, three new blocks are needed in the Flow. The following blocks are needed before the Datastore Post block and/or the Transfer to Mindful block:

  • Call Data Action to retrieve the OAuth token

  • Call Data Action to perform the offer-decision API call using the OAuth token

  • Decision block to evaluate the shouldOffer boolean response

Note: If the Mindful Scheduler Widget was being used for an offer decision, the offer-decision API request will replace it in the Flow.
  1. Add a Call Data Action block after the initial Find Queue block.

    • Category - Select the OAuth Integration that was created earlier.

    • Data Action - Select the Token Retrieval Data Action.

      example of adding a data actionexample of adding a data action
    • Success Outputs - In the access_token field, assign the variable Task.access_token.

      data action configuration
  2. Add another Call Data Action block on the success path of the Token Retrieval Data Action.

    • Category - For this new Call Data Action block, select the Integration that contains the Get Offer Data Action.

    • Data Action - Select the Get Offer Action created earlier.

      data action configuration
    • Call Target URL - Enter the offer-decision endpoint URL, including your Call Target ID.

    • AuthToken - Assign the expression Task.access_token.

    • Success Outputs - Assign Task variables to each of the outputs you would like to capture and evaluate.

      get offer block showing success output variables
  3. Finally, add a Decision block to evaluate the Task.shouldOffer boolean value (and any other variables of interest returned by the API) before routing the call to Mindful for a callback offer or transferring the call directly to agents.

    image of the decision block