Giter VIP home page Giter VIP logo

student_assistant_bot's Introduction

Student_assistant_bot

This sample bot is designed to make a student's life seamless on matters academics and resources. It uses Twilio as the messaging client, Google's Dialog flow for intent filtering, and runs on a Node.js server.

Requirements

Initial Set up and Installation

Clone the repo & Install the required packages

git clone https://github.com/Dev-Elie/Student_assistant_bot.git
cd Student_assistant_bot
npm install

Step1: Setting Up Dialogflow

Creating an Agent

  1. Go to the Dialogflow website (https://dialogflow.cloud.google.com/) and sign up for an account.

  2. On the Dialogflow console, click the Create Agent button in the top left corner.

  1. Enter a name for your agent and select the default language and time zone. Then click on the Create button.

Creating an Intent

  1. In the left sidebar of the Dialogflow console, click on the Intents option.

  1. Click on the Create Intent button.

  1. Add some training phrases that represent the user's input. These phrases should represent the type of input the intent is designed to handle.

As you will see in the later steps, a user can respond to the bot using phrases above or others that match the intent and get the desired response.

  1. Under the Action and parameters section, define an action. We describe an action studentassistant.MENU that triggers the show welcome menu logic in your service.

When a user says something similar to a training phrase, Dialogflow matches it to the intent, which is responsible for showing the welcome menu message.

This action-based response logic \controllers\response\controller.js file.

  1. Click on the Save button to save your changes.

  2. Repeat the same process for portals and events. The training phrases are everyday words or stuff we say. For example, for the Portal intent, we can have training phrases like “portal,” “my portal,” “students portal,” and a number depending on how the options appear in the response. Say, we have the responses in this order:

  1. Portals
  2. Events

We can therefore have 1 and 2 as training phrases.

You are free to add as many intents as you desire while adding more logic to handle the same.

That’s it; Dialogflow is ready to match user responses to the right actions.

Step 2: Creating a Google Cloud Service Account and Downloading client.json File

Here’s a video tutorial to help you set up.

Once you have downloaded the client.json file, proceed to \config\config.js and fill it in with your keys from the downloaded file. Remember, these are sensitive credentials, and the news is there’s no unique way I have handled them in this project. You might want to store them as environment variables.

Good job, just one more set up to go, buddy 🙂

Step 3: Setting up Twilio

  1. Log in to your Twilio console (https://console.twilio.com/)

  2. On the top right, click on the Account menu.

  1. On the drop-down, select API Keys & tokens. Once created, add the Live credentials;

TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN to your .env file.

  1. Start Ngrok as follows.

ngrok http 3000

For more info on setting up Ngrok, see the Getting started steps.

  1. On the Twilio console, on the left sidebar, go to Messaging > Settings > WhatsApp sandbox settings.

  2. On the Ngrok terminal, copy the forwarding URL and paste it in the space “WHEN A MESSAGE COMES IN” in the following format.

https://f749-197-156-137-143.eu.ngrok.io/webhook

Make sure to append /webhook at the end of the URL.

  1. Save the changes.

  2. Finally, on your WhatsApp, send a message to the WhatsApp number in the WhatsApp sandbox participants section with the issued code.

If you get the error

RestException [Error]: Twilio could not find a Channel with the specified From address; double-check that you are using the Live credentials and not the Test credentials.

Viva! That’s all to it. Go ahead and test the bot.

Happy hacking, let’s connect on Twitter @dev_elie

student_assistant_bot's People

Contributors

imgbotapp avatar ondiekelijah avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

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.