Settings
Kind: global class
- Settings
- new Settings()
- instance
- .greeting([text]) ⇒
Promise
- .getStartedButton([payload]) ⇒
Promise
- .whitelistDomain(domains) ⇒
Promise
- .menu([locale], [inputDisabled]) ⇒
MenuComposer
- .greeting([text]) ⇒
- static
new Settings()
Utility, which helps us to set up chatbot behavior
settings.greeting([text]) ⇒ Promise
Sets or clears bot's greeting
Kind: instance method of Settings
Param | Type | Default | Description |
---|---|---|---|
[text] | string |
false |
leave empty to clear |
settings.getStartedButton([payload]) ⇒ Promise
Sets up the Get Started Button
Kind: instance method of Settings
Param | Type | Default | Description | |
---|---|---|---|---|
[payload] | string \ |
object |
false |
leave blank to remove button, or provide the action |
Example
const settings = new Settings(config.facebook.pageToken);
settings.getStartedButton('/start'); // just an action
settings.whitelistDomain(domains) ⇒ Promise
Useful for using facebook extension in webviews
Kind: instance method of Settings
Param | Type | |
---|---|---|
domains | string \ |
Array.<string> |
settings.menu([locale], [inputDisabled]) ⇒ MenuComposer
Sets up the persistent menu
Kind: instance method of Settings
Param | Type | Default |
---|---|---|
[locale] | string |
"default" |
[inputDisabled] | boolean |
false |
Example
const { Settings } = require('botnaut');
const settings = new Settings('page-token-string');
settings
.menu('fr_FR')
.addNested('Nested Menu')
.addUrl('Aller à google', 'https://google.com')
.done()
.addPostBack('Faire quelque chose', '/the/action')
.menu() // the default menu
.addNested('Nested Menu')
.addUrl('Go to google', 'https://google.com')
.done()
.addPostBack('Do something', '/the/action')
.done();
Settings.Settings
Kind: static class of Settings
new Settings(token, [log])
Creates an instance of Settings.
Param | Type |
---|---|
token | string |
[log] | Object |