Meta最近發布了從Whatsapp業務發送訊息的云api,但我無法從google app腳本發送。
我有這段代碼,它運行良好......但它沒有到達用戶
function SendToUser() {
var headers = {
'Authorization' : 'Bearer ACCESS_TOKEN',
'Content-Type': 'application/json'
};
var payload = {
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": "PHONE_NUMBER",
"type": "text",
"text": { // the text object
"preview_url": false,
"body": "MESSAGE_CONTENT"
}
}
var options = {
method: "POST",
headers: headers,
payload: JSON.stringify(payload) // <--- Modified
}
let response = UrlFetchApp.fetch("https://graph.facebook.com/v13.0/FROM_PHONE_NUMBER_ID/messages", options);
Logger.log(response)
}
uj5u.com熱心網友回復:
同樣的事情發生在我身上,答案是正確的,但訊息沒有到達,只有 Hellow_Word 模板的例子在作業,其他的都沒有。
uj5u.com熱心網友回復:
看到這個專案...
https://github.com/pro-cms/whatsappcloud-php
這對我有用:)
uj5u.com熱心網友回復:
看看Heyooh,它是 WhatsApp Cloud API 的 Javascript Wrapper
安裝
npm install heyooh
這里如何發送發送訊息;
import WhatsApp from heyhooh
let messenger = new WhatsApp('TOKEN', phone_number_id='104xxxxxx')
messenger.send_template("hello_world", "255757xxxxxx")
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/481071.html
上一篇:腳本隨機播放單元格值而不是公式
