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

Elixir + Chatbots: A match made in a panacea

Elixir + Chatbots: A match made in a panacea

There is another massive shift happening with how we interact with companies through software. Users feel comfortable naturally talking with their applications through chat bots. Chat is the next generation of the user interface.

Companies like Slack, Facebook, WhatsApp, and WeChat have some of the most popular apps in the world and they are all betting on a messaging interface.

Elixir is the perfect language and ecosystem for building bots and for conversational interfaces. In this session, we will see how we can build scalable, realtime web applications (or “bots”) using a new library Juvet and the Slack API. We will see what a good bot architecture looks like and how we can integrate with existing artificial intelligence services to make our bots smarter.

Jamie Wright

August 09, 2022
Tweet

More Decks by Jamie Wright

Other Decks in Programming

Transcript

  1. USER PLATFORM APP OPS CHANNEL /HELP { CHANNEL: ‘C1234’, USER:

    ‘U8324’, TEAM: ‘T4390’, MESSAGE: ‘/HELP’ } CHAT.POST_MESSAGE(‘HERE IS THE HELP YOU REQUESTED:’) OPS CHANNEL HERE IS THE HELP YOU REQUESTED:
  2. USER PLATFORM APP OPS CHANNEL /HELP { CHANNEL: ‘C1234’, USER:

    ‘U8324’, TEAM: ‘T4390’, MESSAGE: ‘/HELP’ } HOW SLACK WORKS
  3. WHY ELIXIR? B U I LT O N E R

    L A N G ERLANG RELEASED ELIXIR RELEASED 1986 2012
  4. WHY ELIXIR? DEV APP PROCESS PROCESS V 1.0 V 1.1

    V 1.1 V 1.0 V 1.1 V 1.1 V 1.1 V 1.0 V 1.1
  5. WHY ELIXIR? H O T C O D E R

    E L O A D I N G
  6. MIDDLEWARE D E F I N I N G M

    I D D L E W A R E
  7. ROUTING A NICE BLACK BOX YOUR APP ROUTER CONTROLLERS TEMPLATES

    AUTHORIZATION LOW-LEVEL API PLATFORM LIBRARIES HIDE THE PLUMBING
  8. EVERYTHING HAS A PLACE VIEWS CONTROLLERS MODELS ROUTES > BUSINESS

    LOGIC > HANDLES PLATFORM REQUESTS > RUNS MIDDLEWARE > PASSES CONTEXT > CREATES CONTROLLER > RUNS ACTION > HANDLES REQUEST > PREPARES RESPONSE > RENDERS RESPONSE(S) > RETRIEVE DATA > UPDATE DATA > INTEGRATES DATA > PROVIDES RESPONSE
  9. EXTENSION POINTS USER REQUEST PLATFORM APP ROUTER FINDS ROUTE MIDDLEWARE

    IS RUN CONTROLLER IS CREATED ACTION IS CALLED TEMPLATE IS RENDERED RESPONSE IS SENT USER RESPONSE
  10. HARDER TO DEBUG > (PHOENIX.ROUTER.NOROUTEERROR) NO ROUTE FOUND FOR POST

    /SLACK/ACTIONS (TATSUWEB.ROUTER) > (TATSU 0.0.11) LIB/PHOENIX/ROUTER.EX:405: TATSUWEB.ROUTER.CALL/2 > (COWBOY 2.9.0) /TATSU_NEXT/DEPS/COWBOY/SRC/COWBOY_HANDLER.ERL:37: :COWBOY_HANDLER.EXECUTE/2 > (TATSU 0.0.11) LIB/TATSU_WEB/ENDPOINT.EX:1: TATSUWEB.ENDPOINT.PLUG_BUILDER_CALL/2 > … > … > … > … > … > … > … C A L L S T A C K
  11. RANDOM ACCESS MEMORY USER CAN YOU SCHEDULE A MEETING? APP

    I SURE CAN. WITH WHOM? USER WITH TIM. APP GOT IT. WHEN? USER TOMORROW AT 2. APP DONE. I SCHEDULED A MEETING WITH TIM TOMORROW AT 2.
  12. RANDOM ACCESS MEMORY CAN YOU SCHEDULE A MEETING? USER CAN

    YOU SCHEDULE A MEETING WITH TIM TOMORROW AT 2? APP DONE. I SCHEDULED YOUR MEETING WITH TIM FOR TOMORROW AT 2. CAN YOU SCHEDULE A MEETING? USER ACTUALLY CAN YOU MAKE IT FOR 3? APP DONE. I RE-SCHEDULED IT FOR TOMORROW AT 3.
  13. DISCOVERABILITY T R A I N I N G W

    H E E L S ARE YOU READY FOR THE MEETING? YOU CAN REPLY WITH ‘Y’ES OR ’N’O. APP USER YES. MEETING SCHEDULED! DID YOU KNOW YOU CAN REQUEST A RESCHEDULE BY REPLYING ‘RE-SCHEDULE’? APP
  14. VALIDATION ANDY WANTS TO MEET WITH YOU TODAY AT 2.

    APP ARE YOU AVAILABLE? USER BLERG.
  15. VALIDATION I’M SORRY ‘BLERG’ IS NOT AN ANSWER. APP ACKNOWLEDGE

    THE RESPONSE 1. YOU CAN RESPOND ‘YES’ OR ‘NO’ APP PROVIDE CORRECT OPTIONS 2. ANDY WANTS TO MEET WITH YOU TODAY AT 2. APP ARE YOU AVAILABLE? RE-ASK THE QUESTION 3.
  16. SELECTION WHERE DO YOU WANT TO MEET MACKENZIE TONIGHT? APP

    USER 1. 1. COFFEE SHOP 2. RESTAURANT 3. BAR APP O P T I O N R E D U C T I O N
  17. SELECTION OK. WHICH COFFEE SHOP? APP O P T I

    O N R E D U C T I O N 1. CAFE JOE’S 2. STARBUCKS ON MAIN 3. PERKATORY APP
  18. RESPONSE SAMPLING YES APP OK APP CORRECT APP WRONG APP

    NOPE APP LOOKS GOOD APP 👍 APP ✌ APP THAT’S WHAT SHE SAID APP COOL APP