new Facebook_Controller(page_controller, attachment_controller, menu_controller)
Parameters:
Name | Type | Description |
---|---|---|
page_controller |
Page_Controller | A NGINB page controller |
attachment_controller |
Attachment_Controller | A NGINB attachment controller |
menu_controller |
Menu_Controller | A NGINB menu controller |
- Source:
Methods
deleteMessengerProfile(page, fields) → {Object}
Deletes a messenger profile from a given field - See Facebook documentation
Parameters:
Name | Type | Description |
---|---|---|
page |
PageConfig | A PageConfig object |
fields |
String | The fields to delete |
- Source:
Returns:
A bluebird promise facebook response object
- Type
- Object
domainWhitelisting(page, domainArray) → {Object}
Adds a domain or an array of domains to the facebooks domain whitelist
Parameters:
Name | Type | Description |
---|---|---|
page |
PageConfig | A PageConfig object |
domainArray |
String | The array of domais do add (can be only one item) |
- Source:
Returns:
A bluebird promise facebook response object
- Type
- Object
doSubscribeRequest(page) → {Object}
Subscribes a messenger page to receive bot messages - See Facebook documentation
Parameters:
Name | Type | Description |
---|---|---|
page |
PageConfig | A PageConfig object |
- Source:
Returns:
A bluebird promise facebook response object
- Type
- Object
facebookLogin(req, res, redirect_url, scope) → {Object}
Does a facebook login - See Facebook documentation
Parameters:
Name | Type | Description |
---|---|---|
req |
Object | A request object from express |
res |
Object | A response object from express |
redirect_url |
String | The redirect url to be used by facebook API |
scope |
String | The scope of facebook auth request |
- Source:
Returns:
A bluebird promise facebook response object
- Type
- Object
getFacebookMessage(page_id, sender, message, lang, data) → {Object}
Formats a bot message to a facebook message
Parameters:
Name | Type | Description |
---|---|---|
page_id |
String | the facebook page id |
sender |
String | The facebook sender id |
message |
Object | A message object returned by bot controller |
lang |
String | The language of the template to be passed to menu configuration |
data |
Object | A callback object data to be passed after the request |
- Source:
Returns:
A bluebird promise facebook message object
- Type
- Object
getFacebookTemplate(page_id, sender, message, lang, data) → {Object}
Formats a bot message to a facebook template object
Parameters:
Name | Type | Description |
---|---|---|
page_id |
String | the facebook page id |
sender |
String | The facebook sender id |
message |
Object | A message object returned by bot controller |
lang |
String | The language of the template to be passed to menu configuration |
data |
Object | A callback object data to be passed after the request |
- Source:
Returns:
A bluebird promise facebook template object
- Type
- Object
getFacebookToken(code, redirect_url, callback_data) → {Object}
Gets the facebook token by a given code - See Facebook documentation
Parameters:
Name | Type | Description |
---|---|---|
code |
String | A code returned by facebook login page |
redirect_url |
String | The redirect url to be used by facebook API |
callback_data |
Object | A callback object data to be passed after the request |
- Source:
Returns:
A bluebird promise facebook response object
- Type
- Object
getFacebookUserData(access_token, callback_data) → {Object}
Gets a facebook user data by a valid access_token - See Facebook documentation
Parameters:
Name | Type | Description |
---|---|---|
access_token |
String | A code returned by facebook login page |
callback_data |
Object | A callback object data to be passed after the request |
- Source:
Returns:
A bluebird promise facebook response object
- Type
- Object
getFacebookUserDataByCode(code, redirect_url, callback_data) → {Object}
Gets the facebook user data by a given code - See Facebook documentation
Parameters:
Name | Type | Description |
---|---|---|
code |
String | A code returned by facebook login page |
redirect_url |
String | The redirect url to be used by facebook API |
callback_data |
Object | A callback object data to be passed after the request |
- Source:
Returns:
A bluebird promise facebook response object
- Type
- Object
getMessengerProfile(page, fields) → {Object}
Gets a messenger profile from a given field - See Facebook documentation
Parameters:
Name | Type | Description |
---|---|---|
page |
PageConfig | A PageConfig object |
fields |
String | The fields to get info from |
- Source:
Returns:
A bluebird promise facebook response object
- Type
- Object
messengerEvent(data) → {Event}
Takes a facebook message and transform into a NGINB event formated
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | A facebook messenger data object |
- Source:
Returns:
A bluebird promise NGINB event object
- Type
- Event
requestUserData(page, sender_id, callback_data) → {Object}
Gets the facebook user data by a given page/sender_id - See Facebook documentation
Parameters:
Name | Type | Description |
---|---|---|
page |
PageConfig | A PageConfig object |
sender_id |
String | The facebook sender id |
callback_data |
Object | A callback object data to be passed after the request |
- Source:
Returns:
A bluebird promise facebook response object
- Type
- Object
sendAction(page, sender, action, callback_data) → {Object}
Sends a facebook messenger action - See Facebook documentation
Parameters:
Name | Type | Description |
---|---|---|
page |
PageConfig | A PageConfig object |
sender |
String | The facebook sender id |
action |
Object | A facebook action (mark_seen|typing_on|typing_off) |
callback_data |
Object | A callback object data to be passed after the request |
- Source:
Returns:
A bluebird promise facebook response object
- Type
- Object
sendMessage(page, sender, message_data, callback_data) → {Object}
Sends a facebook messenger message - See Facebook documentation
Parameters:
Name | Type | Description |
---|---|---|
page |
PageConfig | A PageConfig object |
sender |
String | The facebook sender id |
message_data |
Object | A facebook message formated data |
callback_data |
Object | A callback object data to be passed after the request |
- Source:
Returns:
A bluebird promise facebook response object
- Type
- Object
setGreetingText(page, greetings) → {Object}
Sets the greetings text of the facebook messenger bot
Parameters:
Name | Type | Description |
---|---|---|
page |
PageConfig | A PageConfig object |
greetings |
Array | String | A String or an Array with greetings messages and locations |
- Source:
Returns:
A bluebird promise facebook response object
- Type
- Object
setMessengerProfile(page, json) → {Object}
Sets a messenger profile from a given json object - See Facebook documentation
Parameters:
Name | Type | Description |
---|---|---|
page |
PageConfig | A PageConfig object |
json |
Object | The json object to set |
- Source:
Returns:
A bluebird promise facebook response object
- Type
- Object
setPersistentMenu(page, menu) → {Object}
Enables the facebook persistent menu (sandwich)
Parameters:
Name | Type | Description |
---|---|---|
page |
PageConfig | A PageConfig object |
menu |
String | The menu name to gets from menus object file, if configured |
- Source:
Returns:
A bluebird promise facebook response object
- Type
- Object
setStartButton(page, payload) → {Object}
Enables the start button for facebook bot
Parameters:
Name | Type | Description |
---|---|---|
page |
PageConfig | A PageConfig object |
payload |
String | A String with the paylod of the start button |
- Source:
Returns:
A bluebird promise facebook response object
- Type
- Object