{"id":20958333,"url":"https://github.com/aiteq/messenger-bot","last_synced_at":"2025-05-14T06:32:06.056Z","repository":{"id":23915618,"uuid":"98461360","full_name":"aiteq/messenger-bot","owner":"aiteq","description":"A Node bot server for the Facebook Messenger Platform","archived":false,"fork":false,"pushed_at":"2025-03-27T06:07:02.000Z","size":1261,"stargazers_count":27,"open_issues_count":57,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-28T04:47:12.090Z","etag":null,"topics":["bot","chatbot","facebook-messenger-bot","facebook-messenger-chatbot","facebook-messenger-platform","messenger-bot","messenger-chatbots","messenger-platform","node","typescript"],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aiteq.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-26T20:04:16.000Z","updated_at":"2025-02-21T15:49:33.000Z","dependencies_parsed_at":"2023-01-14T00:04:29.459Z","dependency_job_id":"21b3a484-aee5-40b1-a9d9-7c1236bc3346","html_url":"https://github.com/aiteq/messenger-bot","commit_stats":{"total_commits":101,"total_committers":1,"mean_commits":101.0,"dds":0.0,"last_synced_commit":"787db43e49139cbdb96a227eceef623c959ab25b"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aiteq%2Fmessenger-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aiteq%2Fmessenger-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aiteq%2Fmessenger-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aiteq%2Fmessenger-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aiteq","download_url":"https://codeload.github.com/aiteq/messenger-bot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254084661,"owners_count":22011920,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bot","chatbot","facebook-messenger-bot","facebook-messenger-chatbot","facebook-messenger-platform","messenger-bot","messenger-chatbots","messenger-platform","node","typescript"],"created_at":"2024-11-19T01:46:43.833Z","updated_at":"2025-05-14T06:32:01.031Z","avatar_url":"https://github.com/aiteq.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @aiteq/messenger-bot\n\n[![npm version](https://badge.fury.io/js/%40aiteq%2Fmessenger-bot.svg)](https://badge.fury.io/js/%40aiteq%2Fmessenger-bot)\u0026nbsp;\u0026nbsp;[![Dependency Status](https://david-dm.org/aiteq/messenger-bot.svg)](https://david-dm.org/aiteq/messenger-bot)\u0026nbsp;\u0026nbsp;[![Build Status](https://travis-ci.org/aiteq/messenger-bot.svg?branch=master)](https://travis-ci.org/aiteq/messenger-bot)\u0026nbsp;\u0026nbsp;[![Coverage Status](https://coveralls.io/repos/github/aiteq/messenger-bot/badge.svg?branch=master)](https://coveralls.io/github/aiteq/messenger-bot?branch=master)\u0026nbsp;\u0026nbsp;[![Codacy Badge](https://api.codacy.com/project/badge/Grade/292b507c8c744281ba35a2cb821a7104)](https://www.codacy.com/app/tomasklima/messenger-bot?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=aiteq/messenger-bot\u0026amp;utm_campaign=Badge_Grade)\n\n#### A TypeScript coded Node.js package for effective building and managing Facebook Messenger Bots.\n\n\u003ctable\u003e\u003ctr\u003e\n\u003ctd\u003e\u003cb\u003e\u003ca href=\"#major-features\"\u003eFeatures\u003c/a\u003e\u003c/b\u003e\u003c/td\u003e\n\u003ctd\u003e\u003cb\u003e\u003ca href=\"#technologies-used\"\u003eTechnologies\u003c/a\u003e\u003c/b\u003e\u003c/td\u003e\n\u003ctd\u003e\u003cb\u003e\u003ca href=\"#getting-started\"\u003eGetting started\u003c/a\u003e\u003c/b\u003e\u003c/td\u003e\n\u003ctd\u003e\u003cb\u003e\u003ca href=\"#use-cases\"\u003eUsage\u003c/a\u003e\u003c/b\u003e\u003c/td\u003e\n\u003ctd\u003e\u003cb\u003e\u003ca href=\"#chat-extensions\"\u003eChat extensions\u003c/a\u003e\u003c/b\u003e\u003c/td\u003e\n\u003ctd\u003e\u003cb\u003e\u003ca href=\"#cli\"\u003eCLI\u003c/a\u003e\u003c/b\u003e\u003c/td\u003e\n\u003ctd\u003e\u003cb\u003e\u003ca href=\"doc/README.md\"\u003eAPI Doc\u003c/a\u003e\u003c/b\u003e\u003c/td\u003e\n\u003ctd\u003e\u003cb\u003e\u003ca href=\"https://aiteq.slack.com/messages/#messenger-bot/\"\u003e\u003cimg src=\"https://a.slack-edge.com/436da/marketing/img/meta/slack_hash_128.png\" width=\"20\"\u003e\u003c/a\u003e\u003c/b\u003e\u003c/td\u003e\n\u003c/tr\u003e\u003c/table\u003e\n\n```typescript\nnew BotServer({\n    verifyToken: \"hasta-la-vista-baby\",\n    accessToken: \"open-sesame\",\n    appSecret: \"too-secret-to-say\"\n})\n.hear(\"order\", async (chat: Chat) =\u003e {\n    await chat.say(\"Well, let's order some Botcoins. I'll just ask you a few details.\");\n    botcoinMachine.placeOrder({\n        amount: await chat.ask(\"How many Botcoins you want to buy?\"),\n        wallet: await chat.ask(\"What's the address of your Botcoin wallet?\"),\n        email: await chat.ask(\"And finally, tell me your email where I should send instructions.\")\n    });\n    chat.say(\"Thank you for your order!\");\n})\n.start();\n```\n\n## Major features\n\n* Express.js based, **event-driven bot server** handling both **[Webhook](https://developers.facebook.com/docs/messenger-platform/webhook-reference)** and **[Chat Extension](https://developers.facebook.com/docs/messenger-platform/guides/chat-extensions)** requests.\n* **Subscribing** to incoming text messages using regular expresions or to events emitted by the webhook middleware.\n* Support for synchronous **conversations** between the bot and users.\n* **Utilities** for calling [Messenger Platform API](https://developers.facebook.com/docs/messenger-platform) functions from code **outside** chatbot flow.\n* Standalone **CLI** for instant access to backing functions of the Messenger API.\n* Complete **type definitions** so the package is ready to be used in both **JavaScript** and **TypeScript** projects.\n\n## Technologies used\n\n#### Node.js\n[Node](https://nodejs.org/) is an open-source, cross-platform JavaScript run-time environment for executing JavaScript code server-side. Fot its event-driven architecture capable non-blocking I/O it is perfectly fitting platform for **building chatbots**.\n\n#### TypeScript\nA syntactical superset of JavaScript adding static typing, implementing object-oriented principles and adopting latest ES features like generics, decorators or reflection. For Node projects the [TypeScript](http://www.typescriptlang.org/) especially brings a **higher level of maintainability**.\n\n#### Express\n[Express](https://expressjs.com/) is a helpful framework built around Node.js for performing actions as a web server. The package uses the Express for **handling webhook** requests (incoming chat messages) as well as providing access to **Chat Extensions**.\n\n#### Axios\n[Axios](https://github.com/mzabriskie/axios) provides fully Promise based HTTP client functionality, so it was a clear choice for implementation of **calling Facebook Graph APIs**.\n\n#### Embedded JavaScript Templates\n[EJS](http://ejs.co/) is a very simple templating language that helps to create HTML for the pages to be shown in a programmatic way with injecting values. The package uses the EJS for **rendering Chat Extensions**.\n\n#### Jest\n[Jest](https://facebook.github.io/jest/) is yet another unit testing framework by Facebook. It covers all needed unit testing areas: tests definition, assertion and code coverage measuring and reporting. In addition the Jest supports TypeScript and Promises. It's interface is just right balanced between descriptiveness and verbosity, so its using is very intuitive..\n\n#### Grunt\nAs a task runner the [Grunt](https://gruntjs.com/) helps to organize building, releasing and maintaining the package.\n\n## Getting started\n\n### Prerequisites\n- [Node](https://nodejs.org/en/download/) installed\n- [TypeScript](http://www.typescriptlang.org/index.html#download-links) installed\n- [Facebook developers account](https://developers.facebook.com)\n- «optional» [ngrok](https://ngrok.com/download) (or any other tunnel tool) for developing and debuging locally\n\n### Install\n```bash\nnpm install @aiteq/messenger-bot --save\n```\n\n### Facebook application\nCreate and setup a Facebook application using [Quick Start Guide](https://developers.facebook.com/docs/messenger-platform/guides/quick-start) and find out *access token* and *app secret*.\n\n### Bot code\nCreate ```index.ts``` and let's go to start coding:\n```typescript\nimport { BotServer, Chat } from \"@aiteq/messenger-bot\";\n```\n\n\u003ca id=\"createinstance\"\u003e\u003c/a\u003e\nCreate an instance of [BotServer](doc/classes/botserver.md):\n```typescript\nlet bot: BotServer = new BotServer({\n    name: \"MyBot\",\n    port: process.env.PORT || 8080,\n    verifyToken: \"hasta-la-vista-baby\",\n    accessToken: \"open-sesame\",\n    appSecret: \"too-secret-to-say\"\n});\n```\n\nSubscribe for some text:\n```typescript\nbot.hear(\"hello\", (chat: Chat) =\u003e {\n    chat.say(\"Hello! I'm Emil, the Bot. How are you?\");\n});\n```\n\nStart the server:\n```typescript\nbot.start();\n```\n\n### Build and start\nAdd some scripts to ```package.json```:\n```json\n\"scripts\": {\n    \"compile\": \"tsc -p .\",\n    \"start\": \"node ./dist/index.js\"\n},\n```\n\nCreate ```tsconfig.json```:\n```json\n{\n    \"compilerOptions\":\n    {\n        \"module\": \"commonjs\",\n        \"target\": \"es6\",\n        \"rootDir\": \"src\",\n        \"outDir\": \"bin\"\n    },\n    \"include\": [ \"src/**/*\" ]\n}\n```\n\nTranspile the source:\n```bash\nnpm run compile\n```\n\nNow the bot is ready and you can bring it to live:\n```bash\nnpm run start\n```\n\nStart ngrok:\n```bash\nngrok http 8080\n```\nand copy the provided https:// URL for the following step.\n\n### Setup the webhook\nFollow [the guide](https://developers.facebook.com/docs/messenger-platform/guides/quick-start#steps), paste the previously copied URL to *Callback URL* and add ```/webhook```. So, if the URL provided by ngrok is e.g. ```https://54d4f722.ngrok.io```, the Callback URL will be ```https://54d4f722.ngrok.io/webhook```.\n\nSet ```hasta-la-vista-baby``` (see [creating the bot above](#createinstance)) as *Verify Token* and click *Verify and Save*.\n\n### It's alive!\nNow the bot is listening for messages sent to your page. Try to send message \"hello\".\n\n## Use cases\n\n### Hooking text\nYou can subscribe to specific content of incoming text messages in two ways: exact *commands* and *regular expressions*. The subscribing is done using the [BotServer.hear()](doc/classes/botserver.md#hear) method.\n\n#### Commands\nHooking exact words or phrases can be useful when your bot is supposed to listen for commands like a CLI. Commands are specified as strings or arrays of strings and are considered to be case-insensitive.\n```typescript\nbot.hear(\"wait\", (chat: Chat) =\u003e {\n    chat.say(\"I'm waiting ...\");\n})\n.hear([\"sleep\", \"go sleep\", \"go to sleep\"], (chat: Chat) =\u003e {\n    chat.say(\"Well, good night\");\n});\n```\n\n#### Regular expressions\nSubscribing to specific content using regular expressions is much more flexible than listing exact words. Like commands, regular expressions can be specified as an array or single. If the regular expression contains capturing groups they are passed to the callback as third argument.\n```typescript\nbot.hear(/^good (night|morning)$/i, (chat: Chat, text: string, captured: string[]) =\u003e {\n    chat.say(`Hi, good ${captured[0]}!`);\n});\n```\nIn addition, you can mix commands and regular expressions in the same array.\n\n**Note**: The regular expressions are used exactly as given, so if you want to test the text in case-insensitive manner you must explictily indicate it (the `i` flag).\n\n### Hooking events\nBesides searching for specific text you can also subscribe to a number of events emitted while the bot is receiving messages through webhook. The subscribing is done using the [BotServer.on()](doc/classes/botserver.md#on) method.\n\nCheck the [Webhook.Event](doc/enums/webhook.event.md) enum for complete set of available events.\n\n#### Identified Postback events\nWhen subscribing to Postback based events\n- [Postback button](doc/enums/webhook.event.md#postback_button)\n- [Persistent Menu item](doc/enums/webhook.event.md#persistent_menu)\n- [Quick Reply button](doc/enums/webhook.event.md#text_quick_reply)\n\nyou have two options:\n1. subscribe to the **type** of the event and receive all events of this type (e.g. Persistent Menu item selected):\n```typescript\nbot.on(Webhook.Event.PERSISTENT_MENU, (chat: Chat) =\u003e {\n    chat.say(\"You've selected some menu item, but I really don't know what you want to do...\");\n});\n```\n\n2. subscribe to the specific **ID** in addition to the type, what is much more useful way:\n```typescript\nbot.on(Webhook.Event.PERSISTENT_MENU, \"menu-item-about\", (chat: Chat) =\u003e {\n    chat.say(\"What can I say about myself... I'm a bot.\");\n});\n```\n\u003ca id=\"conversation\"\u003e\u003c/a\u003e\n\n### Conversation\nConversation is synchronous message exchange between users and the bot by setting a flow of questions and answers. It's a useful way to get conventional UI tasks, like form filling, closer to interpersonal communication.\n\nIn order to ensure execution of steps of the conversation synchronously, all methods of the [Chat](doc/classes/chat.md) class return Promises. So you can call next step after resolving the current. And when you add a little bit of syntactic sugar using the ```async```/```await``` concept, the conversation flow will look much more readable, almost like a real dialog.\n\nThere are two methods for interaction with the user:\n* [ask()](doc/classes/chat.md#ask) - asking with plain text question\n* [askWithMessage()](doc/classes/chat.md#askwithmessage) - asking with structured message\n\n**Note:** No events are emitted and no hear handlers called when the bot receives an answer to the question asked.\n\n```typescript\nbot.on(Webhook.Event.PERSISTENT_MENU, \"menu-item-song\", async (chat: Chat) =\u003e {\n    profile.favSong = await chat.ask(\"What's your favourite song?\");\n});\n```\n\nOr more complex flow:\n\n```typescript\nbot.on(Webhook.Event.PERSISTENT_MENU, \"menu-item-order\", async (chat: Chat) =\u003e {\n    await chat.say(\"Well, let's order some Botcoins. I'll just ask you a few details.\");\n    order.amount = await chat.ask(\"How many Botcoins you want to buy?\");\n    order.wallet = await chat.ask(\"What's the address of your Botcoin wallet?\");\n    order.email = await chat.ask(\"And finally, tell me your email where I should send instructions for payment.\");\n    chat.say(\"Thank you for your order!\");\n});\n```\n\n#### Input validation\nAs with classic forms, even in the case of a conversation, we need to validate user inputs. Therefore, the interface offers the ability to call a validation function wich you can pass when calling the [ask()](./doc/classes/chat.md#ask) method. As a validator you can conveniently use functions from [validator.js](https://github.com/chriso/validator.js) package:\n```typescript\nimport * as validator from \"validator\";\n\nbot.on(Webhook.Event.PERSISTENT_MENU, \"menu-item-form\", async (chat: Chat) =\u003e {\n    //...\n    let email: string = await chat.ask(\"Give me your email address, please\", validator.isEmail)\n    //...\n});\n```\nThe bot will automatically repeat the question until the user enters a valid email address.\n\n#### Unanswered questions\nThe questions asked using the [ask()](doc/classes/chat.md#ask) or [askWithMessage()](doc/classes/chat.md#askwithmessage) method may remain unanswered by the user. In order to avoid pending Promises these questions are set to automatically expire. The expiration period is set to 5 minutes by default but you can override it using [BotConfig.askTimeout](doc/interfaces/botconfig.md#asktimeout) parameter. The unanswered question is rejected after its expiration. If you want to react to this situation you may catch the rejection:\n\n```typescript\nbot.on(Webhook.Event.PERSISTENT_MENU, \"menu-item-name\", async (chat: Chat) =\u003e {\n    try {\n        let name = await chat.ask(\"What's your name?\");\n        chat.say(`Hello, ${name}. My name is Emil.`);\n    } catch (error) {\n        chat.say(\"I'm so sorry you have no name.\");\n    }\n});\n```\nIf you won't catch the expiration the bot will swallow it without consequences. Don't worry about it.\n\n### Media reusing\n\nWhen you're about to send a message with a media attached you can indicate wheather the media should be reused. The bot stores all reusable attachment ID's. When you try to send the same attachment (with the same URL and `reusable` set to `true`) twice or more times the bot replace media's URL with stored attachment ID.\n\n### BotUtils\n\nThe [Facebook Messenger Platform API](https://developers.facebook.com/docs/messenger-platform) contains not only interactive functions for message exchange between the bot and users. There are a lot of services in the API backing the communication like activating [Get Started button](https://developers.facebook.com/docs/messenger-platform/messenger-profile/get-started-button), installing [Persistent Menu](https://developers.facebook.com/docs/messenger-platform/messenger-profile/persistent-menu) or generating [Messenger Code](https://developers.facebook.com/docs/messenger-platform/messenger-code).\n\nSometimes, we also want to send a *push message* - a message sent to the user proactively, not just as a response to some incoming message.\n\nThe above cases are not quite bot-aware functions. Thus, in order to keep [BotServer](doc/classes/botserver.md)'s interface clean, these services are made available through the [BotUtils](doc/classes/botutils.md) class.\n\nAn instance of the [BotUtils](doc/classes/botutils.md) is initialized passing the the ```accessToken```.\n```typescript\nlet utils: BotUtils = new BotUtils(\"open, sesame\");\n```\n\n#### Example: send push message\n```typescript\nutils.sendText(\"123450987643\", \"RATE ALERT: Botcoin price has reached $1,000\");\n```\nSee [BotUtils.sendText()](doc/classes/botutils.md#sendtext)\n\n#### Example: activate Get Started button\n```typescript\nutils.setGetStartedButton();\n```\nSee [BotUtils.setGetStartedButton()](doc/classes/botutils.md#setgetstartedbutton)\n\n#### Example: generate Messenger Code\n```typescript\nutils.generateMessengerCode(\"my-m-code.png\");\n```\nSee [BotUtils.generateMessengerCode()](doc/classes/botutils.md#generatemessengercode)\n\n## Server monitoring\n\nThe bot server supports responding for *ping* requests. By default, the ping service is attached to `/ping` path and may be overrided by [BotConfig.pingPath](doc/interfaces/botconfig.md#pingpath) configuration parameter. The ping request must use the GET method. If all goes well the `\"OK\"` string is returned with 200 HTTP code.\n\nThe ping feature is useful with conjunction with up-time monitoring services like [Uptime Robot](https://uptimerobot.com/).\n\n## Chat extensions\n\nThe package supports [Embedded JavaScript Templates (EJS)](http://ejs.co/) for rendering Chat Extension views. For creating a new extension follow these steps.\n\n#### 1. Implement [ChatExtension](doc/interfaces/chatextension.md) interface\n```typescript\nimport { ChatExtension } from \"@aiteq/messenger-bot\";\n\nexport class MyExtension implements ChatExtension {\n\n    constructor() {\n        // name your extension - the name will be a part of extension's URL\n        super(\"my\");\n    }\n\n    // implement abstract method getModel()\n    public getModel(): any {\n        return {\n            name: \"Captain Nemo\"\n        };\n    }\n}\n```\nThe chat extension class must implement abstract method `getModel()` that provides data to be used in the view.\n\nThe `getModel` is called every time an extension is requested.\n\n#### 2. Create view\n\nIn your project root create `views` folder (default for placing views in Express application) and `my.ejs` file within it.\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n    \u003chead\u003e\n        \u003ctitle\u003eMy Extension\u003c/title\u003e\n    \u003c/head\u003e\n    \u003cbody\u003e\n        \u003cdiv\u003eGreetings, \u003c%= name %\u003e!\u003c/div\u003e\n    \u003c/body\u003e\n\u003c/html\u003e\n```\n#### 3. Add the extension\n\nAt last you have to register the extension to the bot server using the [addChatExtension](doc/classes/botserver.md#addchatextension) method.\n\n```typescript\nbot.addChatExtension(new MyExtension());\n```\n\nNow the extension is ready to use and you can test it pointing to `\u003cyour-bot-url\u003e/ext/my`.\n\n*Note that the default path for extensions is `/ext` and you can chanage it by setting the `extensionPath` property of [BotConfig](doc/interfaces/botconfig.md).*\n\n\n## CLI\n\nThe [BotUtils](doc/classes/botutils.md) class is useful if you need non-interactive functions of the Messenger API to be called within your application. More often, however, you will need to use these features one-time, operatively, or as a part of such automated workflow like shell script. There is a Command Line Interface ready for these cases.\n\n#### General usage\n\n```bash\nmbutil \u003cgroup\u003e [command] [options]\n```\n\nA *group* represents a specific part of the Messenger API. Available groups are:\n\nGroup|Functions\n---|---\n```send```|Send text or attachment message\n```getstarted```|Manage Get Started button\n```greeting```|Manage page's localized greetings\n```menu```|Manage Persistent Menu\n```domains```|Manage Domain Whitelist\n```audience```|Manage Target Audience settings\n```accountlinking```|Manage Account Linking settings\n```chatext```|Manage Chat Extensions settings\n```code```|Generate Messenger Code\n\nFor each group, you can view help by:\n```bash\nmbutil \u003cgroup\u003e --help\n```\n\nGlobal options:\n\nOption|Function\n---|---\n```--config \u003cpath\u003e```|path to the config JSON file; must contain the ```accessToken``` property\n```--accessToken \u003ctoken\u003e```|*access token* (one of ```--config``` or ```--accessToken``` must be specified)\n```--help```|display help for the group\n\n\n#### Group: ```send```\nSend plain text or attachment push message.\n\nUsage:\n```bash\nmbutil send \"\u003ctext\u003e\" --recipient \u003cid\u003e [options]\nmbutil send image|audio|video|file --url \u003curl\u003e --recipient \u003cid\u003e [options]\n```\n\nOptions:\nOption|Function\n---|---\n```--recipient \u003cid\u003e```|ID of the recipient\n```--url \u003curl\u003e```|URL of the file to be attached\n\n#### Group: ```getstarted```\nManage [Get Started button](https://developers.facebook.com/docs/messenger-platform/messenger-profile/get-started-button).\n\nDisplay current setting:\n```bash\nmbutil getstarted get [options]\n```\n\nActivate the button with optional data:\n```bash\nmbutil getstarted set [--data \"\u003cdata\u003e\"] [options]\n```\n\nRemove the button:\n```bash\nmbutil getstarted delete [options]\n```\n\nOptions:\nOption|Function\n---|---\n```--data \"\u003cdata\u003e\"```|text or JSON to be send when the user tapped the button\n\n#### Group: ```greeting```\nManage page's localized [Greeting](https://developers.facebook.com/docs/messenger-platform/messenger-profile/greeting-text).\n\nDisplay current setting:\n```bash\nmbutil greeting get [options]\n```\n\nAdd localized greeting text:\n```bash\nmbutil greeting add \"\u003ctext\u003e\" [--locale \u003clocale\u003e] [options]\n```\n\nRemove greeting text:\n```bash\nmbutil greeting delete [options]\n```\n\nOptions:\nOption|Function\n---|---\n```--locale \u003clocale\u003e```|greeting's locale ([supported locales](https://developers.facebook.com/docs/messenger-platform/messenger-profile/supported-locales)); if omitted the text will be set as default\n\n#### Group: ```menu```\nManage [Persistent Menu](https://developers.facebook.com/docs/messenger-platform/messenger-profile/persistent-menu).\n\nDisplay current setting:\n```bash\nmbutil menu get [options]\n```\n\nSet Persistent Menu according to definition in a JSON file:\n```bash\nmbutil menu set --file \u003cpath\u003e [--locale \u003clocale\u003e] [options]\n```\n\nRemove Persistent Menu:\n```bash\nmbutil menu delete [options]\n```\n\nOptions:\nOption|Function\n---|---\n```--file \u003cpath\u003e```|path to menu definition JSON file\n\nRequired structure of the JSON menu definition file is clear from the following example (object contains two variants of the menu for `\"default\"` and `\"cs_CZ\"` locales):\n```json\n{\n    \"default\": {\n        \"composerInputDisabled\": false,\n        \"items\": [\n            {\n                \"title\": \"Show exchange rate\",\n                \"id\": \"menu-rate\"\n            },\n            {\n                \"title\": \"Buy Botcoins\",\n                \"id\": \"menu-buy\"\n            },\n            {\n                \"title\": \"Aiteq International, Ltd.\",\n                \"url\": \"http://www.aiteq.international\"\n            }\n        ]\n    },\n    \"cs_CZ\": {\n        \"composerInputDisabled\": false,\n        \"items\": [\n            {\n                \"title\": \"Aktuální kurz\",\n                \"id\": \"menu-rate\"\n            },\n            {\n                \"title\": \"Koupit Botcoiny\",\n                \"id\": \"menu-buy\"\n            },\n            {\n                \"title\": \"Aiteq Reloaded, s.r.o.\",\n                \"url\": \"http://www.aiteq.com\"\n            }\n        ]\n    }\n}\n```\n\n#### Group: ```domains```\nManage [Domain Whitelist](https://developers.facebook.com/docs/messenger-platform/messenger-profile/domain-whitelisting).\n\nDisplay current whitelisted domains:\n```bash\nmbutil domains get [options]\n```\n\nAdd one or more domains (space separated list) to the whitelist:\n```bash\nmbutil domains add \u003cdomain\u003e [domains] [options]\n```\n\nDelete the domain whitelist:\n```bash\nmbutil domains delete [options]\n```\n\n#### Group: ```audience```\nManage [Target Audience](https://developers.facebook.com/docs/messenger-platform/messenger-profile/target-audience) settings.\nCountries are identified by [ISO 3166 Alpha-2 codes](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2).\n\nDisplay current setting:\n```bash\nmbutil audience get [options]\n```\n\nOpen Target Audience for all countries:\n```bash\nmbutil audience open [options]\n```\n\nClose Target Audience for all countries:\n```bash\nmbutil audience close [options]\n```\n\nAdd one or more countries (space separated list) to the whitelist:\n```bash\nmbutil audience whitelist \u003ccountry\u003e [countries] [options]\n```\n\nAdd one or more countries (space separated list) to the blacklist:\n```bash\nmbutil audience blacklist \u003ccountry\u003e [countries] [options]\n```\n\nRemove all Target Audience settings:\n```bash\nmbutil audience delete [options]\n```\n\n#### Group: ```accountlinking```\nManage [Account Linking URL](https://developers.facebook.com/docs/messenger-platform/messenger-profile/account-linking-url).\n\nDisplay currently set Account Linking URL:\n```bash\nmbutil accountlinking get [options]\n```\n\nSet Account Linking URL:\n```bash\nmbutil accountlinking set \u003curl\u003e [options]\n```\n\nDelete currently set Account Linking URL:\n```bash\nmbutil accountlinking delete [options]\n```\n\n#### Group: ```chatext```\nManage [Chat Extension URL](https://developers.facebook.com/docs/messenger-platform/messenger-profile/home-url).\n\nDisplay currently set Chat Extension URL and settings:\n```bash\nmbutil chatext get [options]\n```\n\nSet Chat Extension URL:\n```bash\nmbutil chatext set \u003curl\u003e [options]\n```\n\nDelete currently set Chat Extension URL:\n```bash\nmbutil chatext delete [options]\n```\n\nOptions:\nOption|Value|Function\n---|---|---\n```--inTest```| |controls whether public users can see the Chat Extension\n```--shareButton```| |controls whether the share button in the webview is enabled\n\n#### Group: ```code```\nGenerate [Messenger Code](https://developers.facebook.com/docs/messenger-platform/messenger-code).\n\nSet Chat Extension URL:\n```bash\nmbutil code generate [options]\n```\n\nOptions:\nOption|Value|Function\n---|---|---\n```--out```|path|output file's path and name (default: ```./code.png```)\n```--size```|number between ```100``` - ```2000```|size of generated image, in pixels (default: ```1000```)\n```--ref```|text|data to be received when user scans the code (optional)\n\n## API documentation\nPackage's [reference API documentation](doc/README.md) is located in [doc](doc/README.md) folder.\n\n## Credits\nTomáš Klíma, [Aiteq](http://www.aiteq.com) \u0026 [Aiteq](http://www.aiteq.international)\n\n## License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faiteq%2Fmessenger-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faiteq%2Fmessenger-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faiteq%2Fmessenger-bot/lists"}