Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Plugging in your Bot - An extensible bot framework for Drupal 8

Plugging in your Bot - An extensible bot framework for Drupal 8

Presentation at DrupalCon 2017 Baltimore

Rafael Silva

April 25, 2017
Tweet

More Decks by Rafael Silva

Other Decks in Programming

Transcript

  1. Plugging in your Bot
    An extensible bot framework for Drupal 8

    View Slide

  2. Who we are
    &
    @rfsbsb
    @ezufelt

    View Slide

  3. We build the right thing, fast.
    @myplanetHQ

    View Slide

  4. PREMISES
    • This talk is not about AI
    • This talk is about chatbots, Drupal and the end user
    • This talk is also about extending Drupal with plugins

    View Slide

  5. WHAT ARE WE GOING TO COVER?
    • Chatbot overview
    • Common use cases for chatbots
    • Current state of chatbots and Drupal
    • Our implementation
    • Demos
    • Future for chatbots and Drupal

    View Slide

  6. What are chatbots?

    View Slide

  7. A chatbot is a service, powered
    by rules and sometimes artificial
    intelligence, that you interact
    with via a chat interface.

    Chatbot Magazine

    View Slide

  8. Common use cases

    View Slide

  9. EXAMPLES OF CHATBOTS
    • Weather/forecast (HiPoncho Facebook bot)
    • Survey (Surveybot)
    • Todo list (Todobot)
    • News (CNN Facebook bot)
    • Catalog/buying options (Nordstrom bot)
    • Just chat (Xiaoice)

    View Slide

  10. Chatbots and Drupal

    View Slide

  11. CHATBOTS AND DRUPAL
    • Bot
    • AIML Parser
    • Facebook Messenger Bot

    View Slide

  12. Enter the Chatbot module

    View Slide

  13. THE CHATBOT MODULE
    • Drupal 8
    • Forked from Whitehouse’s Facebook Messenger Bot module
    • It’s extensible through the Plugin API
    • Comes with 2 plugins: Facebook and Slack

    View Slide

  14. COMPONENTS OF A CHATBOT
    • Message Type
    • Messages
    • Steps
    • Workflows

    View Slide

  15. Message Types
    Buttons
    Text
    Image
    Decision
    Video

    View Slide

  16. Step

    View Slide

  17. Workflow

    View Slide

  18. DEMO

    View Slide

  19. EXTENDING THE CHATBOT MODULE
    • You will implement a plugin using Plugin API
    • Your message types
    • The service (i.e how to talk to your chat
    provider)
    • The workflow

    View Slide

  20. A CHATBOT PLUGIN EXAMPLE
    /**
    * Facebook Chatbot implementation.
    *
    * @ChatbotPlugin(
    * id = "chatbot_facebook",
    * title = @Translation("Facebook Chatbot")
    * )
    */
    class ChatbotFacebook extends ChatbotPluginBase implements ChatbotPluginInterface {

    public function challenge() {
    return $this->service->challenge();
    }
    public function parsePostData(Request $request) {
    return $request->getContent();
    }
    }

    View Slide

  21. DEMO II

    View Slide

  22. FUTURE IMPROVEMENTS
    • There’s room for code refactoring
    • Add new message types
    • Integration to AI services (Amazon Lex / IBM Watson / Microsoft Luis / wit.ai / api.ai)

    View Slide

  23. #drupalsprints
    Friday, April 28, 2017
    Mentored Core Sprint

    9:00am-12:00pm

    Room:301-303
    General Sprints

    9:00am-6:00pm

    Room:309-310

    View Slide

  24. THANK YOU!
    WHAT DID
    YOU THINK?
    Locate this session at the
    DrupalCon Baltimore website:
    http://baltimore2017.drupal.org/schedule
    Take the survey
    https://www.surveymonkey.com/r/
    drupalconbaltimore
    https://goo.gl/9s1OiM

    View Slide