Giter Club home page Giter Club logo

google_sheet_reader_bot's Introduction

google_sheet_reader_bot

Telegram bot to get data from Google Sheet, checks the very first column for time (in hours) and returns rows where time matches

steps to use

1. Create Google Sheet with the data. The very first column is treated as a key for the start time of event. You may have multiple rows with the same key, all of them they will be displayed then.

Start Time Where Description Author
9 red room first talk description John Doe
10 red room talk about javascript Jack Black
11 red room some marketing talk bs William White
9 green room some keynote talk John Baker
10 green room networking and coffee Bob Will
11 green room some use case for node.js Diana White

2. Publish this Google sheet (File - Publish To Web - OK)

3. (for heroku) Create a new app on heroku (say, "myapp-bot-app")

3. (for cloud9) Create account on c9.io, create Node.js workspace and run the command git clone [email protected]:emirn/google_sheet_reader_bot.git

4. Register telegram bot (send /newbot commmand to register bot with https://telegram.me/BotFather in Telegram) and copy token for newly created bot.

5. Copy config.js.example into config.js

6. Fill values in config.js to set:

module.exports = {
 'TelegramProductionURL': 'https://myapp-bot-app.herokuapp.com/', // your heroku app do not forget trailing "/" !!
 'TelegramToken': '<telegram token here>', // Telegram token you got from @BotFather
 'googleSheetKey': '<google sheet key>', // the key of the google sheet (should be public!), extract key from the google sheet doc publich url
 "confTimeZone": "Europe/Berlin" // time zone of the conference so the bot could output events for the current time in the form like "Europe/Berlin", see http://momentjs.com/timezone/
}

7. Install required packages using npm install command in the console

8 (for heroku). Push the code to heroku using commands git add ., git commit -m "initial version" and then finally git push

9 (for cloud9). Simply run the bot on the workspace using the command node .. IMPORTANT: cloud9 is mostly for development purposes, if you want to run the bot as product then consider running on Heroku too.

Congrats! Now you may send the command like 10 to the bot and it will send you all events which are taking place at 10 o'clock according to the spreadsheet.

You may change the spreadsheet and the bot will take new data form the spreadheet online.

How it works for enduser:

  • add the bot to the Telegram using the link https://telegram.me/yourbot where yourbot will be replaced with your actual bot name
  • send 'Hi' to the bot to show events taking place at the current time (in the timeone defined by config.confTimeZone)
  • or send the time in a form of 12 for 12 PM, 14:43 for 2.43 PM etc.
  • the bot will list all events taking place at time entered

google_sheet_reader_bot's People

Contributors

emirn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

google_sheet_reader_bot's Issues

Getting Bad request errors when requesting google sheet reader

Hello,
I'm testing this project using c9.io but I'm getting http 400 errors when doing a request on the spreadsheet, is the url to the spreadsheet still correct?
When executing that url in a browser I get the message: "Invalid query parameter value for grid_i"

Problem running your program

Hi,
I'm not a programmer and I'm sorry to annoy you with this problem.
I would like to create a Telegram bot like your so I followed your detailed guide but I had some problems: (this is the message I receive when I run the program)

albo94:~/workspace (master) $ node .
secon-bot server started...
Web server started at http://:::8080
Error: null
Status code: 400
Error: null
Status code: 400

I think (I hope) I've done correctly the first 6 step of your guide. Now I've some doubts about the following steps: I've just written your commands in Cloud9 console...is it right?
These are my results:

albo94:~/workspace (master) $ npm install
npm WARN package.json [email protected] No repository field.
[email protected] node_modules/body-parser
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected]
├── [email protected] ([email protected])
└── [email protected] ([email protected], [email protected])

[email protected] node_modules/express
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected])
└── [email protected] ([email protected], [email protected])

[email protected] node_modules/node-telegram-bot-api
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
└── [email protected]

[email protected] node_modules/request
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected])

[email protected] node_modules/moment-timezone
└── [email protected]
albo94:~/workspace (master) $ git add .
albo94:~/workspace (master) $ git commit -m "initial version"
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
albo94:~/workspace (master) $ git push
Warning: Permanently added 'github.com,192.30.253.112' (RSA) to the list of known hosts.
Everything up-to-date

I'm sorry for my stupid question
Thank you for your time

Alberto

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.