Fireship · @fireship

Angular Chatbot with Dialogflow (API.ai)

Uploaded October 22, 2017 · Length 11:38

Angular Chatbot with Dialogflow (API.ai)

Summary

build an angular chatbot with dialogflow (api.ai) in 10 minutes, using the javascript sdk and angular cli

  • angular chatbot
  • dialogflow api.ai
  • javascript sdk
  • angular cli
  • conversational experiences
  • machine learning
  • natural language processing

Transcript preview

The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.

  1. 0:00

    building a chatbot with angular and

  2. 0:01

    dialogue flow is almost too easy

  3. 0:04

    in this video I'm going to show you how

  4. 0:05

    to go from zero to chatbot in about 10

  5. 0:07

    minutes

  6. 0:08

    dialogue flow which was formerly known

  7. 0:10

    as API AI is an engine for building

  8. 0:13

    conversational experiences it harnesses

  9. 0:15

    Google's machine learning and natural

  10. 0:17

    language processing technology then

  11. 0:19

    gives developers a user-friendly

  12. 0:21

    interface to build chat BOTS and deploy

  13. 0:23

    them to any platform including the web

  14. 0:25

    or slack or facebook Messenger in this

  15. 0:28

    episode we're going to use the

  16. 0:29

    JavaScript SDK to build our chat BOTS

  17. 0:31

    directly in angular this is just the

  18. 0:33

    first video of a multi-part series so

  19. 0:35

    make sure to subscribe if you're just

  20. 0:36

    finding me for the first time and head

  21. 0:38

    over to angular firebase comm to grab

  22. 0:40

    the source code for this feature let's

  23. 0:43

    start by building a new angular app from

  24. 0:44

    the command line using ng new chat bot

  25. 0:47

    and then we'll CD into that folder then

  26. 0:49

    we'll install the JavaScript SDK via NPM

  27. 0:52

    in the development environment at this

  28. 0:54

    point the SDK is still called API AI but

  29. 0:57

    that may change to dialogue flow in the

  30. 0:59

    future then I'm going to tell the

  31. 1:00

    angular CLI to not prefix our components

  32. 1:03

    with app so we can just go into the

  33. 1:05

    angular CLI JSON file and replace app

  34. 1:08

    with an empty string so at this point if

  35. 1:10

    you run ng serve you should just have a

  36. 1:12

    basic angular app the next step is to

  37. 1:14

    flesh out a feature module for our code

  38. 1:16

    this step is technically optional but it

  39. 1:19

    is a good practice and it will make your

  40. 1:20

    life a lot easier as your app grows more

  41. 1:22

    complex the first step is to generate a

  42. 1:24

    module called chat and we can add

  43. 1:27

    resources to this module for example a

  44. 1:29

    service and we'll use the M flag to make

  45. 1:31

    sure that it's included in this module

  46. 1:33

    and then we'll also create a component

  47. 1:35

    called chat dialogue and placed that in

  48. 1:37

    the module as well you can see on the

  49. 1:39

    file structure on the Left how all of

  50. 1:41

    our resources are nested under the chat

  51. 1:43

    folder and components and services are

  52. 1:45

    registered inside the chat module the

  53. 1:47

    only extra bit that we need to add is

  54. 1:49

    the angular forms module and then we're

  55. 1:51

    also going to set our chat dialogue

  56. 1:53

    component to exports so it can be used

  57. 1:55

    directly in the app component you might

  58. 1:57

    also do this with the router but our app

  59. 1:59

    doesn't have a router so we're not going