Add Hubot

What things required to deploy a bot to a channel?

This section explains things required to deploy a bot to a channel in Slack, HipChat(XMPP) or Mattermost, Microsoft Teams

Adding a bot with hubot configurations in Slack or Hipchat.
 Slack
  1. Go to the Slack web API page and sign up to create a Slack team or sign into an existing account where there is an administrative privileges.
  2. After signed in go to the Bot Users page.
  3. Name the bot, then click the “Add bot integration” button.
  4. The page will reload and an access token will be generated.

    Slack Token

    Slack Token are also known as Bot User Token which is required while deploying a bot. 

  5. Click the "Save Integration" button at the bottom of the page. The bot is now ready to connect to Slack's API.
 Hipchat (XMPP)
  1. Sign in an existing team with a separate credential for the bot to work independently as botuser
  2. Go to the Account settings option by clicking the user icon on the top right corner
  3. Click XMPP/Jabber info link in the menu. Make a note of the Jabber ID which will be used to deploy the bot
 Mattermost

1. Click on the  located at the top left corner beside your team name

2. Select Integrations from the drop down menu 

you must have Team Admin or higher privilege in your Mattermost server to have this option enabled for you.

3. Select Incoming Webhooks option

4. Click on the  button at the top right corner

5. Give a title (preferabely a meaningful one so that you can understand later for which bot it is being used), description of the webhook (optional) and select a channel from the dropdown. Your will be able to communicate with your bot with the channel selected here, provided your bot is a member of this channel.

6. After filling all details, click save. Next you will see your incoming url for that channel. Copy this and keep it saved somewhere, as this should be provided as the Mattermost Incoming Url while adding your bot through the OnBots Add bot screen.

7. Next, go back to integrations page and click on Outgoing Webhooks. Click on  button on the top right corner.

8. Give a title for the webhook, optional description and select the same channel selected while creating incoming webhooks. Give a dummy url inside the Callback URLs (One Per Line) option, as this will be modified later once your bot is deployed through OnBots UI. Click save.

9. You will see a 26 character Token. Copy this and keep it saved somewhere, as this should be provided as the 

10. After deploying your bot through OnBots, Click on the Click button corresponding to your bot (located at the last column of OnBots Manage screen).

11. Copy the entire URL you see in the pop-up window.

12. Update your outgoing webhook (Go to your concerned outgoing webhook → Select Edit → Paste the copied URL into the field named Callback URLs (One Per Line) → Click Update)

13. You are ready to chat with you bot from the channel now. Commands should be given in this format: @botname <command>

bot will reply by the name of the user who has configured the incoming and outgoing webhooks. Hence, it is recommended to deploy your bot inside OnBots with the same name as your mattermost username which will be used as a bot.

 Microsoft Teams
  1. Register/Create a new bot in https://dev.botframework.com/bots/new  . Click here to create a bot for Microsoft Teams. 
  2. In Configuration section, select "Messaging endpoint" option which expects the https endpoint <https://HOST_IP:EXPRESS_PORT/BOTBUILDER_ENDPOINT> where the bot is running. HOST_IP : host machine where bot is running. EXPRESS_PORT: port number where hubot is running. BOTBUILDER_ENDPOINT : Sets a custom HTTP endpoint for your bot to receive messages on (default is /api/messages).
  3. Upon successful registration of bot, App Id and secret/password will be generated. 
  4. Create a manifest.json (manifest schema reference) file along with two png images (one for bot logo and another for bot icon).Fill in the manifest.json with the app id, password obtained after registering the bot and other required information. 
  5. Make a zip contains the manifest.json & 2 png file. Upload the zip to MS teams store (the box icon on the bottom left of MS teams chat window). how to upload to store: https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/apps/apps-upload
  6. After successful upload, click on the uploaded zip in MS teams window. You will see a dialogue box contains a switch named "Bot" which should be turned on. You will also have a dropdown to specify what are all the teams(similar to groups/channels) the bot should be installed in. After specifying this, click Install. Now this bot is available in all the specified teams.
  7. After this you can chat with the bot from the teams/personal chat. For teams, prefix the commands with @botname.