1
我正在使用這個node.js
腳本來更新我的Facebook漫畫問候文本,但是當我應用它時,我看到問號而不是字符?阿拉伯語的Facebook機器人問候文本顯示問號?
var request = require('request');
//=========================================================
// Facebook setup // Run only when need updating.
//=========================================================
// Set FB bot greeting text
facebookThreadAPI('./fb-greeting-text.json', 'Greeting Text');
// Set FB bot get started button
facebookThreadAPI('./fb-get-started-button.json', 'Get Started Button');
// Calls the Facebook graph api to change various bot settings
function facebookThreadAPI(jsonFile, cmd){
// Start the request
request({
url: 'https://graph.facebook.com/v2.6/me/thread_settings?access_token=djsaldksa',
method: 'POST',
headers: {'Content-Type': 'application/json'},
form: require(jsonFile)
},
function (error, response, body) {
if (!error && response.statusCode == 200) {
// Print out the response body
console.log(cmd+": Updated.");
console.log(body);
} else {
// TODO: Handle errors
console.log(cmd+": Failed. Need to handle errors.");
console.log(body);
}
});
}
,這是問候語文件
{
"setting_type":"greeting",
"greeting":{
"text":"مرحبا "
}
}
是否有一個限制,即只有其英文?
但我只是更新一次,而不是整個設置。我需要使用一些json編碼嗎? –