Genesys Cloud - Main

 View Only

Discussion Thread View
  • 1.  Genesys Cloud Integration with Mulesoft (Web Service data intergration)

    Posted 04-12-2024 10:17

    Hi Team,

    I'm trying to create Web service data action integration for Mulesoft endpoint to fetch the customer information.

    I tried different ways to build the different authentication method , basic auth & user defined oAuth but nothing seems to work. I tried using postman & its work without any issue.

    Attaching the postman collection json below... could someone help me with right approach to build Genesys cloud data action & integration ?

    {
        "info": {
            "_postman_id": "b8efdf78-7607-4a44-b933-4a9ecc11de00",
            "name": "DEV: Contacts-Genesys",
            "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
            "_exporter_id": "33285836"
        },
        "item": [
            {
                "name": "Generate token",
                "event": [
                    {
                        "listen": "test",
                        "script": {
                            "exec": [
                                "var data = pm.response.json();\r",
                                "pm.collectionVariables.set(\"access_token\", data.access_token);"
                            ],
                            "type": "text/javascript",
                            "packages": {}
                        }
                    }
                ],
                "request": {
                    "auth": {
                        "type": "basic",
                        "basic": [
                            {
                                "key": "password",
                                "value": "xxxxxxxxxxxxxx",
                                "type": "string"
                            },
                            {
                                "key": "username",
                                "value": "xxxxxxxxxxxxx",
                                "type": "string"
                            }
                        ]
                    },
                    "method": "POST",
                    "header": [],
                    "url": {
                        "raw": "https://xxxxxxxxxxxxxxx",
                        "protocol": "https",
                        "host": [
                            "dev-apint",
                            "bat",
                            "net"
                        ],
                        "path": [
                            "bat-p-c4ev2-oauth2-t",
                            "v2",
                            "oauth2",
                            "token"
                        ],
                        "query": [
                            {
                                "key": "grant_type",
                                "value": "client_credentials"
                            }
                        ]
                    }
                },
                "response": []
            },
            {
                "name": "Contacts_by_phoneNumber",
                "request": {
                    "auth": {
                        "type": "bearer",
                        "bearer": [
                            {
                                "key": "token",
                                "value": "xxxxxxxxxxxxxxx",
                                "type": "string"
                            }
                        ]
                    },
                    "method": "GET",
                    "header": [],
                    "url": {
                        "raw": "https:// xxxxxxxxxxxxxxxxxxxxxxxxxx",
                        "protocol": "https",
                        "host": [
                            "dev-apint",
                            "bat",
                            "net"
                        ],
                        "path": [
                            "bat-e-md2b-sf-petra-d",
                            "v1",
                            "contacts"
                        ],
                        "query": [
                            {
                                "key": "endMarketISO",
                                "value": "DE"
                            },
                            {
                                "key": "phoneNumber",
                                "value": "xxxxxxxxx"
                            },
                            {
                                "key": "",
                                "value": "",
                                "disabled": true
                            }
                        ]
                    }
                },
                "response": []
            }
        ],
        "variable": [
            {
                "key": "access_token",
                "value": ""
            }
        ]
    }

    #Integrations

    ------------------------------
    Adesh Jadhav
    Orange SA
    ------------------------------


  • 2.  RE: Genesys Cloud Integration with Mulesoft (Web Service data intergration)

    Posted 04-15-2024 20:23

    Did you setup an integration for the Basic or Oauth and then place the token received in the request header?  What is the disabled output you are getting?  What error are you getting in the data action?



    ------------------------------
    Robert Wakefield-Carl
    ttec Digital
    Sr. Director - Innovation Architects
    Robert.WC@ttecdigital.com
    https://www.ttecDigital.com
    https://RobertWC.Blogspot.com
    ------------------------------



  • 3.  RE: Genesys Cloud Integration with Mulesoft (Web Service data intergration)

    Posted 04-16-2024 03:43

    Thanks Robert for your response.

    1. When tried Basic auth .. i'm getting error "No authentication bearer token specified in authorization header"
    2. When tried to use User defined oAuth integration action execute but its gives me null results.

    I have attached both integration actions code below

    1. Basic Auth Action 
      {
        "name": "Get Account info-Basic Auth (MuleSoft) B2B GLO Germany - Exported 2024-04-16 @ 13:05",
        "integrationType": "custom-rest-actions",
        "actionType": "custom",
        "config": {
          "request": {
            "requestUrlTemplate": "https://dev-apint.bat.net/bat-e-md2b-sf-petra-d/v1/contacts?endMarketISO=DE&phoneNumber=09628914600",
            "requestType": "GET",
            "headers": {
              "Authorization": "Bearer ${input.access_token}"
            },
            "requestTemplate": "${input.rawRequest}"
          },
          "response": {
            "translationMap": {},
            "translationMapDefaults": {},
            "successTemplate": "${rawResult}"
          }
        },
        "contract": {
          "input": {
            "inputSchema": {
              "type": "object",
              "properties": {
                "access_token": {
                  "type": "string"
                }
              },
              "additionalProperties": true
            }
          },
          "output": {
            "successSchema": {
              "type": "object",
              "properties": {},
              "additionalProperties": true
            }
          }
        },
        "secure": false
      }
      2. User defined oAuth action
    {
      "name": "Get Account info-oAuth (MuleSoft) B2B GLO Germany - Exported 2024-04-16 @ 13:05",
      "integrationType": "custom-rest-actions",
      "actionType": "custom",
      "config": {
        "request": {
          "requestUrlTemplate": "https://dev-apint.bat.net/bat-e-md2b-sf-petra-d/v1/contacts?endMarketISO=DE&phoneNumber=09628914600",
          "requestType": "GET",
          "headers": {
            "Authorization": "Bearer ${input.access_token}"
          },
          "requestTemplate": "${input.rawRequest}"
        },
        "response": {
          "translationMap": {},
          "translationMapDefaults": {},
          "successTemplate": "${rawResult}"
        }
      },
      "contract": {
        "input": {
          "inputSchema": {
            "type": "object",
            "properties": {
              "access_token": {
                "type": "string"
              }
            },
            "additionalProperties": true
          }
        },
        "output": {
          "successSchema": {
            "type": "object",
            "properties": {},
            "additionalProperties": true
          }
        }
      },
      "secure": false
    }


    ------------------------------
    Adesh Jadhav
    Orange SA
    ------------------------------



  • 4.  RE: Genesys Cloud Integration with Mulesoft (Web Service data intergration)

    GENESYS
    Posted 04-17-2024 09:25

    In neither case should your token be specified as an input to the action; the token is either something that will be created by the auth auction and leveraged in your subsequent actions using the authResponse velocity template namespace (see https://help.mypurecloud.com/articles/how-to-use-the-user-defined-oauth-credential-type/), or the token is something that is assembled as part of the basic auth credential type in the header of the action.  

    Which option you choose is going to be determined by the API you're connecting to; if that API requires a bearer token, then you'll need to use the custom oauth, which will need your credentials associated with the integration to hit the authorization endpoint specified by the vendor to return the token, which will then be referenced in your subsequent data action.  



    ------------------------------
    Richard Schott
    Genesys - Employees
    ------------------------------



  • 5.  RE: Genesys Cloud Integration with Mulesoft (Web Service data intergration)

    Posted 04-17-2024 14:55
    Thank you, Richard.
     
    I have created an auth action, which gives me the below result, but I'm still confused about how to create subsequent actions to fetch the actual information. I'm sorry, but I'm quite new to the Genesys world.



    ------------------------------
    Adesh Jadhav
    Orange SA
    ------------------------------



  • 6.  RE: Genesys Cloud Integration with Mulesoft (Web Service data intergration)

    GENESYS
    Posted 04-18-2024 09:24

    Adesh,

    That would follow the example here: https://help.mypurecloud.com/articles/how-to-use-the-user-defined-oauth-credential-type/ under bullet 3 almost exactly.  The data actions that are interfacing with the mulesoft APIs would need the elements required from the auth action (most likely the authorization header) referenced using the "authResponse.{{foo}}" pattern described in the documentation.  



    ------------------------------
    Richard Schott
    Genesys - Employees
    ------------------------------



  • 7.  RE: Genesys Cloud Integration with Mulesoft (Web Service data intergration)

    Posted 30 days ago

    Hi Richard,

    It looks like my output contact unable to fetch the information within the array.

    Here is reponse from Mulesoft, I tried multiple things but getting error to setup the array.  Validate output against schema: JSON failed output schema validation for the following reasons: instance type (object) does not match any allowed primitive type (allowed: ["array"])

    [
        {
            "partyId": "001070xxxxxxx",
            "position": "Manager",
            "preferredLanguage": "German",
            "salutation": "Ms.",
            "firstName": "-",
            "endMarketISO": "DE",
            "lastName": "Nesci Bruna",
            "phoneNo": "075xxxxx",
            "faxNo": "07531xxxx",
            "name": "- Nesci Bruna",
            "isPrimaryContact": true,
            "contactId": "00307000003kDydAAE",
            "preferredContactMethod": "Phone",
            "preferredLanguageB2B": "de",
            "createdDate": "2021-04-21T14:30:25.000Z",
            "lastModifiedDate": "2021-05-13T11:59:07.000Z",
            "systemModifiedDate": "2021-05-13T11:59:07.000Z",
            "status": "Active",
            "customerCode": "720510xxxx"
        }
    ]


    ------------------------------
    Adesh Jadhav
    Orange SA
    ------------------------------



Need Help finding something?

Check out the Genesys Knowledge Network - your all-in-one access point for Genesys resources