我在Bootbot存储库上编写了一些代码。
bot.module(echoModule);
bot.on('message', (payload, chat) => {
const text = payload.message.text;
chat.say(`Echo: ${text}`);
});
curl -X POST -H "Content-Type: application/json" -d '{
"get_started": {"payload": "<postback_payload>"}
}' "https://graph.facebook.com/v2.6/me/messenger_profile?access_token=<PAGE_ACCESS_TOKEN>"
bot.hear(['hello', 'hi', 'hey', '/start'], (payload, chat) => {
chat.say('Hey, select one of there!');
bot.setPersistentMenu([
{
type: 'postback',
title: 'Consultation',
payload: 'PERSISTENT_MENU_CONS'
},
{
type: 'postback',
title: 'Request',
payload: 'PERSISTENT_MENU_REQ'
}
]);
});
我有类似SyntaxError的错误:
curl -X POST -H "Content-Type: application/json" -d '{
^^^^
SyntaxError: Unexpected identifier
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:188:16)
at bootstrap_node.js:609:3
在Ngrok上运行,您可以在github上看到lib(Bootbot facebook bot) 请帮我。存储库中有很多lib和模块,也许其中有错误。