Security
This section elaborates on the security mechanism used by the Voice Insights Data Exports APIs. You will need to compute a signature using your Voice Insights Signing Secret, to ensure the requests authenticity.
You can find the Signing Secret under the Account page in Voice Insights.
Keep your Signing Secret in a secure place, preferably encrypted. Do not share it with anyone and do not store it in version control.

Calculate API Signature

To calculate the signature for the request, we will need the following parameters:
Parameter
Description
Example
signingSecret
The signing secret found in the Account page
8ae43a67cdad49b0bf50021cc9b42126
timestamp
The current UNIX timestamp represented as a number in milliseconds
1588693960211
requestPath
The request path including query parameters if any*
/contacts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee?q=hi
* Ensure the querystring parameters in the requestPath are ordered alphabetically.
Follow the sample code below to compute your signature:
Javascript
Python
1
const crypto = require('crypto');
2
3
const computeSignature = (signingSecret, timestamp, requestPath) => {
4
let unencryptedSignature = `v1:${timestamp}:${requestPath}`;
5
let computedSignature = `v1=${crypto.createHmac('sha256', signingSecret).update(unencryptedSignature).digest('hex')}`;
6
return computedSignature;
7
};
8
9
const options = {
10
"method": "GET",
11
"hostname": "exports.voiceinsights.ai",
12
"path": "/contacts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee?q=hi",
13
"headers": {
14
"x-api-key": "<your-api-key>"
15
}
16
};
17
18
const timestamp = new Date().getTime();
19
const signature = computeSignature("<your-signing-secret>", timestamp, options.path);
20
21
options["x-nlx-timestamp"] = timestamp;
22
options["x-nlx-signature"] = signature;
23
Copied!
1
import hmac
2
import hashlib
3
from datetime import timezone, datetime
4
5
def compute_signature(signing_secret, timestamp, request_path):
6
unencrypted_signature = str.encode('v1:' + str(timestamp) + ':' + request_path)
7
computed_signature = 'v1=' + hmac.new(str.encode(signing_secret), unencrypted_signature, hashlib.sha256).hexdigest()
8
return computed_signature
9
10
request_path = '/contacts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee?q=hi'
11
headers = {
12
'x-api-key': '<your-api-key>',
13
}
14
15
timestamp = int(datetime.now(tz=timezone.utc).timestamp() * 1000)
16
signature = compute_signature('<your-signing-secret>', timestamp, request_path)
17
18
headers['x-nlx-timestamp'] = timestamp;
19
headers['x-nlx-signature'] = signature;
20
Copied!
Last modified 1yr ago
Copy link