Get started

API Base URL

{{baseURL}} = https://api.wesal.dev/api/v1

Wesal portal offers easy and simple integration options that require minimal technical effort. This will help you streamline your operations and improve efficiency.

In order to use this API, you will need to complete a login process to obtain an access token. To receive instructions on how to obtain this access token, please contact us at [email protected].


Login


# Here is a get surveys request example
curl --location '{{baseURL}}/auth/login' \
--header 'Content-Type: application/json' \
--header 'X-Client-Id: RW5jb2RlIHRvIEJhc2U2NCBmb3JtYXQ=' \
--data '{
    "email":"[email protected]",
    "password":"123456789"
}'

To login, make a POST request to the following URL:
{{baseURL}}/auth/login

The support team will provide you with the Base64 hashes for your Client ID.



Result example :

{
    "data": {
        "user":{
            "id": 879987,
            "firstName": "Ahmed",
            "lastName": "Mohammed",
            "email": "[email protected]",
            "status": 1,
            "createdAt": "2023-10-18T11:28:23.027Z",
            "updatedAt": "2023-10-18T11:28:23.027Z"
        },
        "access_token":"2RlIHRvIEJhc2U2NCBmb3Jt..."
    },
    "success": true
}

Request Parameters

Field Type Description
X-Client-Id String Base64 hashes for Client ID, its provided by support team
email String Login email
password String Login password

Reset Password


# Step 1: send reset code
curl --location '{{baseURL}}/auth/reset' \
--header 'Content-Type: application/json' \
--header 'X-Client-Id: RW5jb2RlIHRvIEJhc2U2NCBmb3JtYXQ=' \
--data '{
    "method":"email",
    "email":"[email protected]",
    "phone":""
}'

# Step 2: verify and reset password
curl --location '{{baseURL}}/auth/verify' \
--header 'Content-Type: application/json' \
--header 'X-Client-Id: RW5jb2RlIHRvIEJhc2U2NCBmb3JtYXQ=' \
--data '{
    "method":"email",
    "email":"[email protected]",
    "verifyCode":"iZvqjoUPKJvhf2XcU1ES",
    "otp":"",
    "password":"123456789"
}'

Step 1: send reset code

To make login make a POST call to the following url :
{{baseURL}}/auth/reset

An email with a reset verification code will send to account email



Result example :

{
    "success": true
}
                

Request Parameters

Field Type Description
X-Client-Id String Base64 hashes for Client ID, its provided by support team
method String method for verify [ email or phone ]
email String Wesal account email

Step 2: verify and reset password

To verify make a POST call to the following url :
{{baseURL}}/auth/verify

Request Parameters

Field Type Description
X-Client-Id String Base64 hashes for Client ID, its provided by support team
method String method for verify [ email or phone ]
verifyCode String Verify code, received on email
email String Wesal account email
Password String New Password

Logout


# Here is a make logout request example
curl --location '{{baseURL}}/auth/logout' \
--header 'Content-Type: application/json' \
--header 'Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXV...' 

 
                

To make logout GET call to the following url :
{{baseURL}}/auth/reset_pwd



Result example :

{
    "success": true
}
                

Request Parameters

Field Type Description
Authorization String api access_token

Get Organization


# Here is a request example to get organization information 
curl --location '{{baseURL}}/queries/organization' \
--header 'Content-Type: application/json' \
--header 'Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXV...'


To get organization information you need to make a GET call to the following url :
{{baseURL}}/queries/organization



Result example :

{
    "data": {
        "organization": {
            "id": 1003,
            "name": "Organization Name",
            "region": "ie",
            "organizationId": "9363d658-d638-××××-911f-××××c1f67181"
        },
        "companies": [
            {
                "id": 100301,
                "name": "Company Name"
            },
            {
                "id": 100302,
                "name": "Company Name"
            }
        ]
    },
    "success": true
}
                

Request Parameters

Field Type Description
Authorization String api access_token.

Get Questions


# Here is a get questions list request example				
curl --location '{{baseURL}}/survey/queries/questions/{companyId}' \
--header 'Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXV...'
                

To get questions list, you need to make a GET call to the following url :
{{baseURL}}/survey/queries/questions/{companyId}



Result example :
{
    "data": {
        "questions": [
           {
                "id": 1,
                "name": "How satisfied are you with callcenter",
                "answers": [
                    {
                        "id": 1,
                        "title": "high",
                        "value": "1"
                    },
                    {
                        "id": 2,
                        "title": "middle",
                        "value": "2"
                    },
                    {
                        "id":3,
                        "title": "low",
                        "value": "3"
                    }                    
                ]
           },
           {
                "id": 2,
                "name": "Would you recommend our service to your friends",
                "answers": [
                    {
                        "id": 23,
                        "title": "yes",
                        "value": "1"
                    },
                    {
                        "id": 24,
                        "title": "no",
                        "value": "2"
                    }                    
                ]
           },
           ...
        ]
    },
    "success": true
}
                

Request Parameters

Field Type Description
Authorization String api access_token.
companyId Number Company ID, its provided by [Get Companies] request

GET SURVEYS


# Here is a get surveys request example
curl --location '{{baseURL}}/survey/queries/surveys' \
--header 'Content-Type: application/json' \
--header 'Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6I...' \
--data '{
    "filters": [
       {
          "dimension": "dateTime",
          "value": {
             "startTime":"2023-12-12T00:00:00",
             "endTime":"2023-12-13T00:00:00"
          }
       }             
    ],    
    "companyId": 1,
    "extended": false,
    "offset": 0,
    "limit": 50
}'

To get Surveys you need to make a POST call to the following url :
{{baseURL}}/survey/queries/surveys



Result example :

{
  "data": {     
     "profile": {        
        "id":1006549887,
        "region": "ie",
        "name":"Wesal",
        "organizationId": "9363d889-xxxx-xxxx-xxxx-cd3ac1f67181",                              
        "companyId":"1000069",
        "companyName":"Hadef IT"
     },  
     "surveys": [
         {
            "id": "9363d889-xxxx-xxxx-xxxx-cd3ac1f67131",            
            "conversation": {	
               "id": "9363d889-xxxx-xxxx-xxxx-cd3ac1f67131",
               "queueName": "SALES-01",               
               "agentName": "Ahmed Mohammed",               				               
               "url": "https://apps.mypurecloud.ie/xxx",               				               			   
               "callerId": "tel:+966xxxxxxxxx",			
               "mediaType": "Voice",
               "createdAt": "2023-10-17T11:28:23.027Z"
            },
            "answers": [
               {
                  "id": 302,
                  "questionId": 853,
                  "questionName": "Service Satisfaction",
                  "answerTitle": "Yes",
                  "answerValue": 1,
                  "createdAt": "2023-10-18T11:28:23.027Z"
               },
               {
                  "id": 303,
                  "questionId": 854,
                  "questionName": "Agent Satisfaction",
                  "answerTitle": "No",
                  "answerValue": 2,
                  "createdAt": "2023-10-18T11:28:23.027Z"
               }
            ]
         }
     ],
     "pagination": {
        "currentPage": 1,
        "totalPages": 491,
        "previousPage": null,
        "nextPage": 2,
        "totalItems": 49093
     }
   },
   "success": true
}
                

Request Parameters

Field Type Description
Authorization String api access_token.
filters Array of Objects A range of possible filter parameters are used to obtain multiple display types
companyId Number Company ID, its provided by [Get Companies] request
offset Number (optional - default: 0) A cursor for use in pagination. Pagination starts offset the specified offset.
limit Number (optional - default: 10) A limit on the number of objects to be returned, between 1 and 100.

Get QUEUES SUMMARY


# Here is a get queues summary request example
curl --location '{{baseURL}}/analytics/runtime/queues/summary' \
--header 'Content-Type: application/json' \
--header 'Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6I...' \
--data '{
	"queues": [
		"01756dxx-xxxx-xxxx-xxxx-7c12cf9a0dxx",
		"02795dxx-xxxx-xxxx-xxxx-2f13cf5a0dxx"
	]	
}'

To get queues summary you need to make a POST call to the following url :
{{baseURL}}/analytics/runtime/queues/summary



Result example :

{
    "data": {
        "success": true,	
        "result": [
           {
              "success": true,              
              "id": "01756dxx-xxxx-xxxx-xxxx-7c12cf9a0dxx",  
              "name": "Sales",
              "memberCount": 11,
              ...
           },
           {
              "success": true,              
              "id": "02795dxx-xxxx-xxxx-xxxx-2f13cf5a0dxx", 
              "name": "Support",
              "memberCount": 33,
              ...
           },
           ...
        ]
    },
    "success": true
}
                

Request Parameters

Field Type Description
Authorization String api access_token.
queues Array array of queues ids, provided by administrator

Get QUEUES ACTIVITY


# Here is a get queues activity request example
curl --location '{{baseURL}}/analytics/runtime/queues/activity' \
--header 'Content-Type: application/json' \
--header 'Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6I...' \
--data '{
	"queues": [
		"01756dxx-xxxx-xxxx-xxxx-7c12cf9a0dxx",
		"02795dxx-xxxx-xxxx-xxxx-2f13cf5a0dxx"
	]	
}'

To get queues activity you need to make a POST call to the following url :
{{baseURL}}/analytics/runtime/queues/activity



Result example :

{
    "data": {
        "success": true,
        "result": [
           {
              "queueId": "01756dxx-xxxx-xxxx-xxxx-7c12cf9a0dxx",         
              "data": [                
                  {
                      "qualifier": "IDLE",
                      "count": 1
                  },
                  ...
              ]
           },
           {
              "queueId": "02795dxx-xxxx-xxxx-xxxx-2f13cf5a0dxx",         
              "data": [                
                  {
                      "qualifier": "IDLE",
                      "count": 1
                  },
                  ...
              ]
           }
        ]
    },
    "success": true
}
                

Request Parameters

Field Type Description
Authorization String api access_token.
queues Array array of queues ids, provided by administrator

Get QUEUES PERFORMANCE


# Here is a get queues performance request example
curl --location '{{baseURL}}/analytics/queues/performance' \
--header 'Content-Type: application/json' \
--header 'Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6I...' \
--data '{
	"queues": [
		"01756dxx-xxxx-xxxx-xxxx-7c12cf9a0dxx",
		"02795dxx-xxxx-xxxx-xxxx-2f13cf5a0dxx"
	],
	"interval": "2024-01-28T09:00:00.000Z/2024-01-28T10:00:00.000Z",
	"partial": false
}'

To get queues performance you need to make a POST call to the following url :
{{baseURL}}/analytics/queues/performance



Result example :

{
  "data": {
    "success": true,  
    "result": [
      {
        "queryId": "01756dxx-xxxx-xxxx-xxxx-7c12cf9a0dxx",
        "data": [
          {
            "interval": "2024-01-28T09:00:00.000Z/2024-01-28T09:30:00.000Z",
            "metrics": {
              "ASA": 43445,
              "Answer": 2,
              "MetSLA": 1,
              "OverSLA": 1,
              ...
            }
          }
        ]
      },
      {
        "queryId": "02795dxx-xxxx-xxxx-xxxx-2f13cf5a0dxx",
        "data": [
          {
            "interval": "2024-01-28T09:00:00.000Z/2024-01-28T09:30:00.000Z",
            "metrics": {
              "ASA": 43445,
              "Answer": 2,
              "MetSLA": 1,
              "OverSLA": 1,
              ...
            }
          }
        ]
      },
      ...
    ]
  },
  "success": true
}
                

Request Parameters

Field Type Description
Authorization String api access_token.
queues Array array of queues ids, provided by administrator
interval String datetime range
partial Boolean true: The query result divided into blocks, block for every 30 minutes

Dictionary

Some global variables used in requests:

Field Type Description
extended Boolean if is set 'true', the response will contains a more details

Errors

API uses the following error codes:

Code Meaning
X0000 Some parameters are missing. This error appears when you don't pass every mandatory parameters.
X001 Unknown or unvalid secret_key. This error appears if you use an unknow API key or if your API key expired.
X002 Unvalid secret_key for this domain. This error appears if you use an API key non specified for your domain. Developper or Universal API keys doesn't have domain checker.
X003 Unknown or unvalid user token. This error appears if you use an unknow user token or if the user token expired.
X004 Invalid request.