Giter Site home page Giter Site logo

bots-workshop's Introduction

HubSpot Bot Workshop

HubSpot bots allows its users to build chat bots to interact with their users. A part of bots is the option to write a code snippet to control the bot. During this workshop we are going to build some code snippets to make some sick bots.

Part 1: Getting Setup

  1. Create an account by responding to the email invitation

  2. Go to "Conversations -> Chatflows" in the top nav of the portal after signing in

  3. Click "More -> Clone" on the Chatflow named "Blank Bot"

  4. Enter a unique name for your Bot Chatflow

  5. Find your new Chatflow in the table

  6. Click "More -> Move to top Priority"

  7. Click "Edit"

  8. Configure targeting

    • set the targeting url to something unique
  9. Toggle the switch in the top right corner of the page

  10. Preview bot in sandbox

you should see something like this:

Part 2: Learning to build bots

All bots consist of three things:

  1. A welcome message
  2. A prompt to start the conversation
  3. Follow up actions

Welcome message

A welcome message is a way to tell your user the purpose of the bot. It will display in a pop up while the widget is closed so it should be something to encourage your visitors to interact with your bot.

Actions and Prompts

Bots require a prompt to start the conversation so it knows a user has started an interaction. Otherwise it could send an unlimited number of messages without any user interaction. The follow up actions can collect information from quick replies or user input, send images or text, and branch to other parts of the boarder conversation tree. When an action is configured to take in user input, the bot will use natural language processing to try and pick out the relevant information from the user response. For example if I configure my bot to save information to the contact address field, it will specifically look for an address.

Alt text

Connections

Connections are what tie together the bot actions into a conversation tree. Each action can be configured with a connection which will divert the bots conversation chain given certain parameters or responses. For example, if a visitor has already interacted with my bot or website and I've already collected their information I can divert my bot to skip the actions that collect that information. These connections can be found under the if/then branch tab of the bot action configuration panel.

Alt text

Part 2: Build a bot

Let's build a bot! There are a bunch of different things bots can do, but most make an api request and echo some data.

To help give some inspiration here is a list of public APIs https://github.com/toddmotto/public-apis

Examples

  1. Cat fact bot
  2. Stock Bot
  3. Trivia bot
    • NOTE: This is an example from MotionAI's implementation (MotionAI is a software company that develops and "trains" chat bots that HubSpot acquired a year ago), so try to incorporate this example into your own
  4. Beer bot
    • Created by Steve Rowell at HubSpot. This bot uses python which is not available to all at this time, but shows that you can collect information through quick replies in the lambda through creating a session and having states stored in a contact property. At HubSpot, we have beer on tap in a bunch of different locations, and using pubspot API, he created a way to output what's on tap. Super cool!

New to javascript? Here's a quick cheat sheet that goes over the syntax.

Challenge

Can you make a bot with several code snippets and branching using nextModuleNickname?

Part 3: How does the bots system run code snippets?

Behind the scenes our systems takes your javascript function and uploads it to AWS Lambada where it waits to be executed by the bot runner. AWS Lambda is a serverless on demand code execution environment that is really great at running a single snippet of code as it does not require having a system constantly running to execute code. Instead of having our own service and having to manage the very variable load of code snippet execution, we can call these lambdas on demand meaning we can execute as many as we want at any time. The downside is that there is a warm up period in order for the lambda executer to build the proper environment for us to execute the snippets in. To combat this, we use the same lambda environment across all of our usage at HubSpot which usually means the environment has been pre warmed up and is ready to execute.

Alt text

Resources on lambda:

  1. AWS Lambda: How it Works
  2. Benchling CRISPR Case Study
  3. Creating AWS Lambda Function Through AWS Console

🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖

bots-workshop's People

Contributors

gdaunton avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

isabella232

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.