Skip to content

An empty structure to create a bot for Telegram and Messenger in NodeJS

License

Notifications You must be signed in to change notification settings

mrigo/emptyNodejsBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

emptyNodejsBot

An empty structure to create a bot for Telegram and Messenger in NodeJS (Slack coming soon...)

Requirements

Installation

  1. Start by cloning this project
  2. Run $ npm install

Usage

  1. Edit the code with all you think your bot must do
  2. Run $ npm start

Other packages

If you need other dependencies in addition to those already present, just type

$ npm install <package> --save

Heroku deployment

You need an active Heroku account, then you can install heroku-toolbelt.

$ brew install heroku-toolbelt
$ heroku login
$ cd *your-app-folder*

Create the app and start a Git repository.

$ git init
$ git add .
$ git commit -am "starting!"
$ heroku create *app-name*
$ git push heroku master

Set some required Config Variables

$ heroku config:set TELEGRAM_BOT_TOKEN=<YOUR_TELEGRAM_TOKEN>
$ heroku config:set FB_VALIDATION_TOKEN=<YOUR_FB_VALIDATION_TOKEN>
$ heroku config:set FB_PAGE_ACCESS_TOKEN=<YOUR_FB_PAGE_ACCESS_TOKEN>

Remember to set the TELEGRAM_BOT_TOKEN without the word "bot" at the beginning!

If you want to track some info into your Google Analytics account set

$ heroku config:set GA_KEY=<YOUR_GOOGLE_ANALYTICS_KEY>

Methods Available

Messenger Methods

var messenger = require('./messenger/messenger');

To send a tex message you can use

messenger.sendTextMessage(recipientId, messageText, callback(response, err));

Telegram Methods

var telegram = require('./telegram/commands');

To send a tex message you can use

telegram.sendSimpleMessage(chat_id, token, messageText, callback(response, err));

TO DO

  • Methods to send more complex messages
  • Slack Integration
  • Tests

Thanks to

About

An empty structure to create a bot for Telegram and Messenger in NodeJS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages