Rozdíly
Zde můžete vidět rozdíly mezi vybranou verzí a aktuální verzí dané stránky.
Obě strany předchozí revize Předchozí verze Následující verze | Předchozí verze | ||
skoda-ep:modules:messenger_bot_module [06.02.2018 14:37] jan.lorenc |
skoda-ep:modules:messenger_bot_module [26.11.2018 17:39] (aktuální) Lukáš Čech |
||
---|---|---|---|
Řádek 1: | Řádek 1: | ||
====== Facebook messenger bot ====== | ====== Facebook messenger bot ====== | ||
- | This module contains available submodule - [[.:messenger_bot_module:shout_cast|ShoutCast]] | + | Standard main setup process - [[.:messenger_bot_module:setup|Setup]] |
- | After successfull instalation and setup covered in this article, continue above on ShoutCast link wiki page. | + | Customization & settings documentation - [[.:messenger_bot_module:customization|Customization]] |
- | ===== Setup Facebook Page ===== | + | Design - [[.::messenger_bot_module:design|Design guidelines]] |
- | Fb messenger bot needs facebook page on behalf which will be communicating. | + | ==== Modules ==== |
- | So its important to create new Facebook page. | + | ShoutCast submodule documentation - [[.:messenger_bot_module:shout_cast|ShoutCast Module]] |
- | After logging into facebook, head over to: | + | Standard & Extender submodule documentation - [[.:messenger_bot_module:st_extender|Standard & Extender Module]] |
- | https://www.facebook.com/pages/create/ | ||
- | After creating page, u can get Page ID from URL, for example: | ||
- | |||
- | https://www.facebook.com/Test-1796766873669723/ => 1796766873669723 (will need this later on) | ||
- | |||
- | Alternative way to obtain Page ID is described here | ||
- | https://www.facebook.com/help/community/question/?id=378910098941520 | ||
- | |||
- | ===== Setup facebook App ===== | ||
- | |||
- | After page creation it's essential to create facebook App and connect it to Page. | ||
- | |||
- | You need to login again as a facebook developer and Create new App | ||
- | |||
- | https://developers.facebook.com/apps | ||
- | |||
- | Afted App creation head to Messenger section | ||
- | https://developers.facebook.com/apps/xxx/messenger/settings/ | ||
- | |||
- | {{:skoda-ep:modules:fb-app-1.png?200|}} | ||
- | |||
- | Select Page from dropdown and generate Token (will be used later) | ||
- | |||
- | {{:skoda-ep:modules:fb-app-2.png?200|}} | ||
- | |||
- | Select a page to subscribe | ||
- | |||
- | {{:skoda-ep:modules:fb-bot-8.png?600|}} | ||
- | |||
- | Next step is to setup webhooks | ||
- | |||
- | {{:skoda-ep:modules:fb-app-3.png?400|}} | ||
- | |||
- | * Callback URL => wordpress endpoint => https://skoda-wlc.ys-dev.cz/wide/wp-json/fb-msg/webhook | ||
- | * Verify Token => write random string (will be used later) | ||
- | * Subscriptions Fields => check "messages" and "messaging_optins" | ||
- | |||
- | Now it's time to setup Wordpress facebook messenger by section "Setup credentials in wordpress". After All is set up, return here and click Verify and Save to finalize setup. | ||
- | |||
- | At first fb messenger bot will be in development mode - only administrator of facebook App will see plugin and be able to optin for notifications - for testing purposes. | ||
- | After development stage is over its essential to submit App for revision to Facebook to enable it for public use. | ||
- | |||
- | {{:skoda-ep:modules:fb-app-4.png?600|}} | ||
- | |||
- | ===== Setup credentials in wordpress ===== | ||
- | |||
- | First step is to enable "YS facebook messenger API" plugin in Plugins => Installed Plugins. | ||
- | |||
- | Then head over to SKODA options => FB messenger tab. You should have all fields gathered from previous sections. | ||
- | |||
- | GENERAL OPTIONS: | ||
- | * App ID => ID of created app in facebook developers console | ||
- | * App Secret => Obtained from App main dashboard in facebook developers console | ||
- | * Page ID => ID of facebook page on which behalf bot will communicate. Obtaining is described in first section of this manual | ||
- | * Verify Token => string set up to validate wordpress API in facebook developers console | ||
- | * Page Access Token => token generated in facebook developers console | ||
- | * Send from all categories => check to send notifications from all published posts. Otherwise only notifications from particular category new posts will be sent | ||
- | |||
- | CUSTOM REPLIES: | ||
- | * Unopted user => Turn on replies for unopted users. By default bot doesn't respond to them | ||
- | * Unopted user text => Custom message reply for unopted user | ||
- | * Opted user (wrong cmd) text => Custom message that will be printed when opted user writes wrong command/reply | ||
- | * Opted user (wrong cmd) append `help` => Append list of available commands to previous message | ||
- | |||
- | SHOUTCAST: | ||
- | * Enable ShoutCast => Completely hide/show ShoutCast module | ||
- | |||
- | ==== Inserting Shortcode into Page ==== | ||
- | |||
- | FB messenger bot plugin needs to be inserted into page, to display optin button for users on frontend. | ||
- | |||
- | In visual editor use shortcode plugin button | ||
- | |||
- | {{:skoda-ep:modules:fb-app-5.png?600|}} | ||
- | |||
- | Or in texteditor shorcode: | ||
- | |||
- | ''[fb-msg-optin msg="Optin for notification!"]'' | ||
- | |||
- | msg => This message displayed on fronend above optin fb button | ||
- | |||
- | {{:skoda-ep:modules:fb-app-6.png?200|}} | ||
- | |||
- | ==== Publishing post with notification ==== | ||
- | |||
- | When publishing new post (or updating older one, which was not notified by FB messenger bot) | ||
- | check "Send one-time publish notification" option. | ||
- | |||
- | {{:skoda-ep:modules:page_publish.png?200|}} | ||
- | |||
- | After publishing/updating, all users opted for selected main category will be notified. In case that wordpress doesn't include "main category" function, notifications will be sent to all assigned post categories. | ||
- | |||
- | Notifications for each post will by sent only once. | ||
- | |||
- | ====== CUSTOMIZATION ====== | ||
- | |||
- | Customisation of all automatic text messagess is possible. | ||
- | |||
- | In SKODA options menu -> two tabs are available | ||
- | |||
- | {{:skoda-ep:modules:messenger_bot_module:fbb-1.png|}} | ||
- | |||
- | ===== FB msg - general ===== | ||
- | |||
- | Whole facebook bot consists of 3 main modules, which can be turn on/off separately to suit your needs. | ||
- | |||
- | {{:skoda-ep:modules:fbb-3.png?300|}} | ||
- | |||
- | it is possible to remap standard commands with custom version. | ||
- | |||
- | Ex. OPTOUT mapping => ODHLASIT. Command OPTOUT will be remapped to ODHLASIT | ||
- | |||
- | Ex. OPTOUT desc => text. Description of command shown when HELP command is invoked by user | ||
- | |||
- | {{:skoda-ep:modules:messenger_bot_module:fbb-2.png|300}} | ||
- | |||
- | ===== FB msg - messages ===== | ||
- | |||
- | First option - Reply to unopted user -> defines if chatbot responds to every user which is not opted into any channel or categories. | ||
- | In textarea after it is possible to craft what that custom response should be. | ||
- | |||
- | Further - this tabs contains many fields to override custom responses for every command issued by user. Various text responses can use replacer placeholder for example [[help]] which appends response from HELP command into your custom message. | ||
- | Descriptions of each field also provides default value which is used if no custom override is set up. |