在阿拉伯语的Facebook机器人问候文本显示问号?

时间:2017-01-18 13:02:21

标签: node.js botframework

我正在使用这个node.js脚本来更新我的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":"مرحبا "
  }
}

是否只有英文版的限制?

1 个答案:

答案 0 :(得分:0)

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