脚本令牌_js调用接口更新
// API配置
const token = '你的token';
const apiUrl = `你的webhook`;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("POST", apiUrl);
xhr.setRequestHeader("Content-Type", "application/json");
// 移除不被CORS允许的AirScript-Token请求头
// 将token放在请求体中
const dataWithToken = JSON.stringify({
"Context": {
"argv": { "value": "老粮仓" }
},
"token": token
});
xhr.send(dataWithToken);