Documentation 1.0

Preconditions

Each API call, described below, needs API Key to be provided in the header of request. The example of simplest request (ex. get the NPS score) may look like following:

GET /nps HTTP/1.1
Host: https://api.clever-insight.com
key: {you api key}
Content-Type: application/json
Accept: application/json

You can simply log in to the system by using link of the following format https://api.clever-insight.com?key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXX

By adding 'menu=0' parameter to the link - you can hide the menu and the ability to move thru the CleverInsight pages

API Methods Specification

Doc Root

Method: GET
URL: https://api.clever-insight.com/
Params: NONE
Description: Current Document
Returns: Current Document
Response Example:
HTTP Code: 200 OK
HTTP Body:

                                    

Login

Method: POST
URL: https://api.clever-insight.com/login
Params:
Mandatory:
Name: login
Type: string
Description: Your login
Name: password
Type: string
Description: Your password
Optional:
Request Example:
POST /send HTTP/1.1
Host: https://api.clever-insight.com
Content-Type: application/json
Accept: application/json
Content-Length: 63

{"login":"mymail@example.com", "password":"s0m3$tr0ngP@ssw0rd"}
Description: Call this to get your api key for future requests
Returns: Your api key
Response Example:
HTTP Code: 200 OK
HTTP Body:
{"apiKey":"46cbc74a803a5b5816b2e773d4bc5613"}

Survey Send

Method: POST
URL: https://api.clever-insight.com/send
Params:
Mandatory:
Name:
Type: array
Description: Multidimensional array with keys: Name, Value [, UID]. If Name=Identity: Value - client's name, UID - client's email or phone number (or comma separated string. In this case email will be preferable). Otherwise arrays should contain Name and Value parameters, where Name - custom data name and Value - it's value.
Optional:
Request Example:
POST /send HTTP/1.1
Host: https://api.clever-insight.com
key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Content-Type: application/json
Accept: application/json
Content-Length: 105

[{"Name":"Identity", "Value":"Smith", "UID":"smith@example.com"}, {"Name":"Depatment", "Value":"General surgery"}]
Description: Call this to send survey to your client
Returns: Associative array with sent and ignored count
Response Example:
HTTP Code: 200 OK
HTTP Body:
{"sent":1,"ignored":0}

NPS

Method: GET
URL: https://api.clever-insight.com/nps
Params:
Mandatory:
Optional:
Name: from
Type: string
Description: String representing date in dd-mm-yyyy format (current date by default)
Name: to
Type: string
Description: String representing date in dd-mm-yyyy format (current date by default)
Request Example:
GET /nps?from=01-01-2017 HTTP/1.1
Host: https://api.clever-insight.com
key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Content-Type: application/json
Accept: application/json
Description: Call this to get NPS data for the period
Returns: Returns associative data array
Response Example:
HTTP Code: 200 OK
HTTP Body:
{"result":{"index":"0.00","data":{"total":0,"promoters":0,"passive":0,"detractors":0},"from":"08-12-2024","to":"08-12-2024"}}

Responded Surveys List

Method: GET
URL: https://api.clever-insight.com/responses
Params:
Mandatory:
Name: client
Type: string
Description: String representing client email or phone number
Optional:
Name: from
Type: string
Description: String representing date in dd-mm-yyyy format (`01-01-1970` by default)
Name: to
Type: string
Description: String representing date in dd-mm-yyyy format (`01-01-1970` by default)
Request Example:
GET /responses?client=example@example.com HTTP/1.1
Host: https://api.clever-insight.com
key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Content-Type: application/json
Accept: application/json
Description: Call this if you want to get list of responded surveys. Use optional parameters to filter the result
Returns: Returns associative data array
Response Example:
HTTP Code: 200 OK
HTTP Body:
[{"email":"client@example.com","comment":"The best service i ever had!","mark":10,"customData":[],"created":"08-12-2024 01:12","updated":"08-12-2024 20:25"}]

List of Surveys

Method: GET
URL: https://api.clever-insight.com/list
Params:
Mandatory:
Optional:
Name: from
Type: string
Description: String representing date in dd-mm-yyyy format (`01-01-1970` by default)
Name: to
Type: string
Description: String representing date in dd-mm-yyyy format (current date by default)
Name: client
Type: string
Description: String representing client email (all responses will be sent back if not present
Name: responded
Type: boolean
Description: TRUE by default. Use FALSE to see all sent emails.
Name: filter
Type: integer
Description: 1 - promoters only, 2 - passive only, 3 - promoters and passive, 4 - detractors only, 5 - promoters and detractors, 6 - passive and detractors, 7(or omitted) - all
Name: tags
Type: array
Description: Associative array with key-value structure - ex. [key => [val1, val2]] (all by default)
Name: limit
Type: integer
Description: Integer value to limit the result set (30 by default)
Name: offset
Type: integer
Description: Integer value to start response with (0 by default)
Request Example:
GET /list?limit=1 HTTP/1.1
Host: https://api.clever-insight.com
key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Content-Type: application/json
Accept: application/json
Description: Call this if you want to get list of sent surveys. Use optional parameters to filter the result
Returns: Returns associative data array
Response Example:
HTTP Code: 200 OK
HTTP Body:
{"result":{"total":1,"nps":{"index":"100.00","data":{"total":1,"promoters":1,"passive":0,"detractors":0}},"requests":[{"email":"client@example.com","comment":"The best service i ever had!","mark":10,"customData":[],"created":"08-12-2024 01:12","updated":"08-12-2024 20:25"}]}}

Webhooks Methods Specification

Response Webhook

Method: POST
URL: Bruger er defineret
Params: NONE
Request Example:
POST /[user defined] HTTP/1.1<br/>Host: [user defined]<br/>Content-Type: application/json<br/>Accept: application/json<br/>Content-Length: 339<br/><br/>{"responses":[{"id":"84", "language":"da", "country":"dk", "date":"2017-03-01T15:25:43.511Z", "name":"John Doe", <br/>"email":"j.doe@example.com", "tags":[{"key":"pet", "value":"Lessie", "comment":"The best friend"}], <br/>"company":"Some Company LTD", "comment":"Love to visit Some Company LTD. I think it is the best one in the branch", <br/>"mark":10}]}
Description: The User defined url will be called each time new response will come
Sends: Associative array of responses
Response Example:
HTTP Code: 200
HTTP Body:
HTTP/1.1 200 OK<br/>Content-Length: 0<br/>