Methods
(inner) getFacebookProfile(fbMessengerId) → {promise}
Get the messenger user's facebook profile
- Source:
Parameters:
Name | Type | Description |
---|---|---|
fbMessengerId |
string
|
facebook messenger ID |
Returns:
- Type:
-
promise
facebook profile consisting: first_name, last_name, profile_pic, locale, timezone, gender is_payment_enabled, last_ad_referral
(inner) setGetStarted(getStartedPayload)
Set the payload for the get started button. Facebook docs on a Get Started Button
- Source:
Parameters:
Name | Type | Description |
---|---|---|
getStartedPayload |
string
|
payload string button is clicked |
(inner) setGreeting(greeting)
Set greeting text for the bot. Facebook docs on Greeting Text
- Source:
Parameters:
Name | Type | Description |
---|---|---|
greeting |
string
|
greeting text |
(inner) setMenu(menu)
Set a facebook messenger persistent menu. Facebook docs on a Persistent Menu
- Source:
Parameters:
Name | Type | Description |
---|---|---|
menu |
object
|
menu object |
(inner) start(bot, cb)
Start an express webserver for the bot.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
bot |
object
|
A bot object created by botkit |
cb |
function
|
A callback function to define routes |
Example
const myBot = facebookBot.controller.spawn({});
facebookBot.start(myBot, (err, webserver) => {
webserver.get('/', (req, res) => {
res.send('<h3>This is a bot</h3>');
});
webserver.get('/other', (req, res) => {
res.send('<h3>This is a bot at route /other</h3>');
});
});