購物車下單後推播訊息
以用戶將購物車內的商品做下單結帳後,並推送訊息給用戶之情境,並以Node.js程式碼為例
Last updated
以用戶將購物車內的商品做下單結帳後,並推送訊息給用戶之情境,並以Node.js程式碼為例
Last updated
{
"success": false,
"errResponse": {
"message": "Token is invalid or expired",
"code": 1004,
"botId": "MantaGO Bot ID"
}
}const axios = require('axios');
const secret = "API Secret Key"
const token = "API Token"
const botId = "MantaGO Bot ID"
const data = { "secret": secret };
const config = {
method: 'post',
url: 'https://mantago.cc/api/openapi/token?botId=botId',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`,
},
data : data
};
async function makeRequest() {
try {
const response = await axios.request(config);
console.log(response.data);
}
catch (error) {
console.log(error);
}
}
makeRequest();
const axios = require('axios');
const secret = "API Secret Key"
const token = "API Token"
const botId = "MantaGO Bot ID"
const lineUUidList = [
"Line user uuid"
]
const data = {
"intentId": "rb2kYmMdW",
"botId": botId,
"clientIds": lineUUidList,
"platform": "line",
"secret": secret
};
const config = {
method: 'post',
url: 'https://mantago.cc/api/openapi/broadcast',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`,
},
data : data
};
async function makeRequest() {
try {
const response = await axios.request(config);
console.log(response.data);
}
catch (error) {
console.log(error);
}
}
makeRequest();
{
"success": true,
"message": "Send customer broadcast successfully"
}const axios = require('axios');
const secret = "API Secret Key"
const token = "API Token"
const botId = "MantaGO Bot ID"
const facebookUUidList = [
"Facebook user uuid"
]
const data = {
"message": "親愛的顧客您好,你已成功下單,可以至消費紀錄查看商品的最新進度",
"botId": botId,
"clientIds": facebookUUidList,
"platform": "facebook",
"fbTag": "POST_PURCHASE_UPDATE",
"secret": secret
};
const config = {
method: 'post',
url: 'https://mantago.cc/api/openapi/broadcast',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`,
},
data : data
};
async function makeRequest() {
try {
const response = await axios.request(config);
console.log(response.data);
}
catch (error) {
console.log(error);
}
}
makeRequest();
{
"success": true,
"message": "Send customer broadcast successfully"
}