Callbot API authorization - nxtele/nxcloud-doc-en GitHub Wiki
This authentication document is for the new v3 API suffix
uuid can be found in the backend -> Developer section secretKey can be found in the backend -> Developer section algorithm can be found in the backend -> Developer section
body is the request body createTs is the request timestamp in seconds requestID is a randomly generated unique request ID (assigned by the caller)
The encryption string is assembled as follows: authRaw= fmt.Sprintf("%s&body=%s&createTs=%s&requestID=%s&uuid=%s",secretKey, body, createTs, requestID, uuid) The signature is encrypted from the original string MD5 or SHA256 and converted to uppercase. Example sign = md5(authRaw).upper() Example sign = sha256(authRaw).upper()
Sample request in Python 3 version - The following are sample keys and UID.
import uuid
import requests
import hashlib
import time
import json
url = 'https://devnxbot.nxcloud.com/callcentre/v2/callinfo'
secretkey = "u7Mf3zUNOkg4lMV9a0E6cHSgIkK22GSr"
uid = "Vh71ym3yQwWSYZFpqkFwTskGXUbSxDtR"
requestId = str(uuid.uuid4().hex)
ts = str((round(time.time())))
body = {"customerId":"1234","appKey":"xxxxxx","status":1}
pre_sign = secretkey + "&body=" + json.dumps(body) + \
"&createTs=" + str(ts) + \
"&requestID=" + requestId + \
"&uuid=" + uid
print(pre_sign)
_sign = hashlib.md5(pre_sign.encode('utf-8')).hexdigest().upper()
header = {
"uuid": uid,
"requestId": requestId,
"sign": _sign,
"createTs": ts,
}
x = requests.post(url, json=body, timeout=250, headers=header)
print(x.text)