Giter VIP home page Giter VIP logo

bot-tutorial-nodejs's Introduction

Sample GroupMe NodeJS Callback Bot

Introduction

This project shows the capability of a bot to react to messages sent within a group.

Contents

Requirements:

Get your bot up and running

Deploy to Heroku:

Be sure to log into heroku, using your heroku credentials, then click the link below.

Deploy

You should be taken to a page that looks like this:

Deploy to Heroku

Optionally, you can give your app a name, or instead leave it blank and let Heroku name it for you (you can change it later).

Success

Next, create a GroupMe Bot:

Go to: https://dev.groupme.com/session/new

Use your GroupMe credentials to log into the developer site.

Log into dev.groupme.com

Once you have successfully logged in, go to https://dev.groupme.com/bots/new

Create your new bot

Fill out the form to create your new bot:

  • Select the group where you want the bot to live
  • Give your bot a name
  • Paste in the url to your newly deply heroku app
    • http://your-app-name-here.herokuapp.com/
  • (Optional) Give your bot an avatar by providing a url to an image
  • Click submit

Find your Bot ID:

Go here to view all of your bots: https://dev.groupme.com/bots

Click on the one you just created.

Select your new bot

On your Bot's page, copy the Bot ID

Copy your Bot ID

Add your Bot ID to your Heroku app:

Go here to see all of your Heroku apps and select the one you just created before:

https://dashboard-next.heroku.com/apps

Select your heroku app

On your app page, click settings in the top navigation:

Go to your app's settings

On your app's setting page, find the Config Vars section and click the Reveal Config Vars button:

Reveal your environment variables

Then click edit:

Edit your environment variables

Fill out the form to add an environment variable to your app:

  • In the "key" field type: BOT_ID
  • In the "value" field paste your Bot ID that you copied in the previous steps
  • Click the save button

Add the Bot ID environment variable

Now go test your bot!

Go to GroupMe and type "/cool guy" in the group where your bot lives to see it in action.

Test your Bot

Make it your own

Pull the code to your local machine

Within terminal, change directory to the location where you would like the files to live, then run this command:

$ heroku git:clone -a YOUR_APP_NAME_HERE

And then change directory into the new folder

$ cd YOUR_APP_NAME_HERE

Configure your local BOT_ID environment variable

Open the file .env from your local files in your text editor of choice. Find where it says "YOUR_BOT_ID_HERE" and replace it with the ID of your new bot.

If you don't know what your Bot ID is, please refer back to this section, where it is explained how to retrieve it.

If your Bot ID is 12345678910, then:

BOT_ID="YOUR_BOT_ID_HERE"

becomes:

BOT_ID="12345678910"

Start the server

To test your bot locally, open terminal and run the following command to start a local server.

$ foreman start

Then navigate to http://127.0.0.1:5000/ in a browser.

Local bot

All done! Go play around and make the bot your own.

bot-tutorial-nodejs's People

Contributors

petemcgrath avatar

Stargazers

 avatar

Watchers

 avatar  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.