我正在使用此node.js脚本更新我的Facebook bot问候语,但是当我应用它时,我看到的是问号而不是字符?

  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":"مرحبا "
  }
}


仅英语有限制吗?

最佳答案

幸运的是,Bot框架不仅限于英语。
您只需要在发送所需的消息之前为阿拉伯语设置Locale参数即可。可以在here中找到它的示例。

关于node.js - Facebook bot阿拉伯语的问候文字显示问号吗?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/41720167/

10-09 17:24