BigFix AEX Socket Connection Service

BigFix AEX Socket Connection Service is a micro service which acts as an intermediary between BigFix AEX and client.

Here, client is the one who exposes the web socket URL.

Inside microservice, socket connection is opened using WS NPM module.

For example, The Genesys integration, where there is a micro service for Genesys.

Figure 1. Figure 477 – Genesys Chat Transfer
Diagram Description automatically generated

There are two generic methods that handle these requests.

Genesys Microservice URL (genesys_wrapper_url):

https://BigFix AEX-socket-wrapper-staging.mybluemix.net

This microservice application contains following endpoints to transmit the chat to agent portal

  • Initiate Connection
  • Message

genesys_wrapper_url is environment specific. Value changes as per the environment.

Initiate Connection: Endpoint created to initiate the connection. It gets the auth token, open the socket connection and creates the guest conversation.

{

'Content-Type': 'application/json'

}

  • REQUEST BODY: Body contains all the parameters required to create the conversation. Apart from this, it is also required to send Return Context and Return Endpoints.
  • Mandatory Fields are hostname, deployment Id, organization Id, Return Context and Return Endpoints.
  • Return Context is used to make the socket channel between Genesys and BigFix AEX. Parameter which is used to make the channel are Customer Code, Conversation ID, User and Source.
  • Return Endpoint is the publish URL used in all chat transfer integrations to populate message from the agent portal to BigFix AEX chat window. Genesys doesn’t have mechanism to use BigFix AEX publish API to show message on BigFix AEX window. Hence, the publish API inside microservice has been consumed. Through microservice, API is called, and message is published on the chat window.

{

"authorization": "Bearer iuIk1Um5axm5_yxxpSJYY2UbXtdBef9h6S9rZYey0g0ghN-_kIruHgtH0c4AUoPBrWWfB_CazUC0cVIIRh4how",

"hostname": "usw2.pure.cloud",

"initiationParams": {

"organizationId": "7df49fef-4212-4dd1-abc9-90f553c70f5a",

"deploymentId": "6940c6dc-4797-4a07-a103-17c0ca8926ff",

"routingTarget": {

"targetType": "queue",

"targetAddress": "BigFix AEXBot"

},

"memberInfo": {

"displayName": "Karan Verma",

"lastName": "Verma",

"firstName": "Karan",

"email": "karan-verma@hcl.com",

"phoneNumber": "+12223334444",

"customFields": {

"some_field": "arbitrary data",

"another_field": "more arbitrary data"

}

}

},

"ReturnContext": {

"CustomerCode": "BigFix AEXmlcc2001",

"CustomerName": "mlcc2",

"ConversationReference": null,

"ConversationId": "142d9a57-de26-4b06-b65f-ac38694af36a",

"Source": "web",

"User": "akanksha.sood@hcl.com",

"lang": "en"

},

"ReturnEndpoints": {

"url": "https://mlcc2-BigFix AEX-staging.mybluemix.net/api/livechat/v1/agentmessage/publish",

"token": "Bearer YjhlMDA0NzktM2YzZi00ZmE3LTgyNjQtMWRlODAzNmU3NzRlLWJkNzU3NzRkLTQ4YzctNDczYS1iOTlhLTExNDkwMzRiNGM1MA=="

}

}

  • RESPONSE: In response, user receives the conversation ID which is further used to send message to Genesys portal and other parameter is ‘Headers’ which contains the “X-Cf-App-Instance” (this parameter makes sure that chat is transferred to the same instance from which chat is initiated. It is sent in headers in message api)

{

"id": "2641c875-f653-4b28-ad52-be002811b5b8",

"headers": {

"X-Cf-App-Instance": "2a735f98-999d-4303-8007-f6ebc31eebd7:1"

}

}

{

"id": "f1b99d66-a39f-431b-b3b8-b17140567d55",

"msg": "hello"

}

HEADERS:

{

'X-Cf-App-Instance': '2a735f98-999d-4303-8007-f6ebc31eebd7:1',

'Content-Type': 'application/json'

}

  • RESPONSE: True/False (It gives the Boolean value which indicates whether the message is transferred or not).

Message transferred from Genesys agent portal to the BigFix AEX chat window is also achieved by the microservice. Inside Microservice only, the publish API of BigFix AEX are called to publish the message to the BigFix AEX chat window.

APIs provided by Genesys:

  1. API to get the token

url: 'https://login.usw2.pure.cloud/oauth/token?grant_type=client_credentials',

method: 'POST',

headers: {

'Content-Type': 'application/json',

'Authorization': 'Basic YjkwZTdiOWYtZjgyMi00MGUxLTkzN2EtZjgxMDA4ZjMwYWExOjdweUlQQzc0LWJPQnpCTE83Uk1ROUVrSEt4OEFoc19leUEyQWs2UXZjUE0='

}

  1. API to create the guest conversation

url: 'https://api.usw2.pure.cloud/api/v2/webchat/guest/conversations',

method: 'POST',

headers: {

'Authorization': 'Bearer EOYNFPZtGAKWJcsxYDE4IWps4hzfXth1693zlC-xy5YRlDS9TTgeMR9mWcCEKMOTJq4LbYkl2ehtxiEUK8sl_A',

'Content-Type': 'application/json'

},

body: {

"organizationId": "7df49fef-4212-4dd1-abc9-90f553c70f5a",

"deploymentId": "6940c6dc-4797-4a07-a103-17c0ca8926ff",

"routingTarget": {

"targetType": "queue",

"targetAddress": "BigFix AEXBot"

},

"memberInfo": {

"displayName": "UserName",

"lastName": "User",

"firstName": "Name",

"email": "user@hcl.com",

"phoneNumber": "+12223334444",

"customFields": {

"some_field": "arbitrary data",

"another_field": "more arbitrary data"

}

}

}

  1. API to send message to current chat

url: 'https://api.usw2.pure.cloud/api/v2/webchat/guest/conversations/e5dacc34-f4c7-4aa4-9b10-63d012a2994e/members/84ce9fce-5c2a-4fcb-9fca-c2d48c5462dc/messages',

method: 'POST',

headers: {

'Authorization': 'access token which is received from create conversation api',

'Content-Type': 'application/json'

},

body: {

"body": "hi this is a new message from user",

"bodyType": "standard"

}