Callbot API authorization - nxtele/http-api-document GitHub Wiki

该鉴权文档为后缀为v3的新接口使用**

uuid可在后台->开发者 查看 secretKey可在后台->开发者 查看 algorithm可在后台->开发者 查看与设置

body 为请求体 createTs 请求秒级时间戳 requestID 随机唯一请求id(调用方进行赋值)

加密原串 通过如下方式组装 authRaw= fmt.Sprintf("%s&body=%s&createTs=%s&requestID=%s&uuid=%s",secretKey, body, createTs, requestID, uuid) 签名由加密原串 MD5或者SHA256加密后转为大写 示例sign = md5(authRaw).upper() 示例sign = sha256(authRaw).upper()

请求示例-python3版-以下为示例key和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)