Setting up Rethink Bot



Basic Programming/Javascript knowledge preferred

  1. Apps Scripting, Node JS, Basic Git knowledge

  2. Telegram bot, Tutorial

  3. Set up Visual Studio Code and git in local machine

  4. Share gitlab repo with writer access


Instructions for Setting up the Rethink Bot.

  • Install the Git Bash and Visual Studio Software. You also require a GitLab account.

  • Create a new telegram bot using the BotFather and the command /newbot and after creating the bot by providing a name and Username of the bot you will get a token.

  • Using the Git Bash clone the git repository.

  • In the terminal of the visual studio upload the cloned Rethink Bot repository using npm install

  • Authorize the bot created using the token received from the BotFather.

  • Git pull the latest update of the Rethink Bot before any edition in the program.

  • To add functionality to the bot

  • Create/ edit the different handlers (functions) in the program and name them accordingly. ( Eg the fig shows the handler to receive the linkedin Profile.). Create new variable names for the handler.(the variables in the given handlers are : linkedinLink, linkedinStatus, linkedinDate)

  • When you create new variables for the handlers add columns corresponding to these variables in the Rethink Database (see fig 3).

  • Also in case of handlers written to receive the submissions edit the submission dates accordingly.

  • Now add the command to invoke the handler in the tg.router (in the fig it is /profile and profileCommand similarly create a command corresponding to the new functionality added.)
    Eg : .when(new TextCommand(’/linkedin’, ‘linkedinCommand’), ghciController)

  • Link the above create variable (‘linkedinCommand’ in the example ) to the corresponding handler. Eg : ‘linkedinCommand’: ‘linkedinHandler’,

  • Save the changes made and do a trial run of the code created on the bot created using the Botfather using the command node bot.js in the Terminal of visual studio. Check whether the google sheet has been updated in the columns added while creating the new functionality.

  • If the bot is responding as required push the bot the main Rethink Bot using the following commands:

    • git add .
    • git commit - mType any message to sent to the git repository
    • git push
  • The telegram group “ Tech Q2 “ shows notification for any updates done in the bot. Now try functionality added in the Rethink Bot using the corresponding command create in the code. Check the whether the Rethink Database is updated and if it is updated correctly then the functionality needed is successfully added to the Rethink Bot