UrbanBotFacebook
Urban bot part which is responsible to launch facebook bot.
Install
npm i @urban-bot/facebook --save
yarn add @urban-bot/facebook
Usage
import { render, Root, Text } from '@urban-bot/core';
import { UrbanBotFacebook } from '@urban-bot/facebook';
const urbanBotFacebook = new UrbanBotFacebook({
appSecret: 'appSecret',
pageAccessToken: 'pageAccessToken',
verifyToken: 'verifyToken',
});
render(
<Root bot={urbanBotFacebook}>
<Text>Hello, Facebook!</Text>
</Root>,
);
Options
appSecret
A facebook app secret. You can get it from Dashboard -> Settings -> Basic https://developers.facebook.com/apps/<YOUR_APP_ID>/settings/basic/.
required
string
const urbanBotFacebook = new UrbanBotFacebook({
appSecret: '436dea778f91b26ba2d082389a9eh951',
});
pageAccessToken
A facebook page access token. You can get it from Messenger -> Settings -> Access Tokens https://developers.facebook.com/apps/<YOUR_APP_ID>/messenger/settings/.
required
string
const urbanBotFacebook = new UrbanBotFacebook({
pageAccessToken: 'EAAIQg0zUkrEBoDSMInBbCf5OwU9TXhUTTUTPWZBdGqvrATyoIKEOphkGKQAl...',
});
verifyToken
A random string that is used to connect facebook bot and your webhook url. Invent it yourself and after starting your bot set it to Messenger -> Settings -> Webhooks https://developers.facebook.com/apps/<YOUR_APP_ID>/messenger/settings/.
required
string
const urbanBotFacebook = new UrbanBotFacebook({
verifyToken: 'randomString',
});