GithubHelp home page GithubHelp logo

ignition-it / accelobot Goto Github PK

View Code? Open in Web Editor NEW
4.0 0.0 1.0 468 KB

Accelo integration for Slack

License: Apache License 2.0

JavaScript 100.00%
accelo slack slack-bot slack-api google google-apps-script apps-script javascript api-integration

accelobot's Introduction

Accelobot

Get interactive Slack notifications every time a new request is created or updated in Accelo!

Example Notification

This integration adds a Slack app to your workspace that posts a message every time a new request is created. It includes action buttons to interact with the request directly from Slack! You can claim, close, and re-open requests without leaving Slack. You can also convert a request to a ticket with a click of a button, which will open a browser page with all the details prefilled. Once a request has been converted to a ticket, the Slack message will automatically update to show the ticket details, and a new button will appear to view the ticket.

Notification with Issue

It also features a configurable blocklist to automatically close requests whose title's contain a blocklist text match. This can be super helpful for cutting down on spam requests from systems that don't have configurable alerts or various other reasons.


Set Up Instructions

  1. Open your Slack Apps page and create a new app. Select From Manifest, and paste the contents of slack_app_manifest.json. There are 2 variables in the Interactivity URL that you'll need to change later after your Google Script web app is published.

Slack App Manifest

  1. Install the app to your workspace and make note of the Bot Token. We'll need to add this to the Script Properties later.

Install Slack App

  1. Go to your Accelo API settings (https://YOUR_SUBDOMAIN.accelo.com/?action=edit_api_application&target=edit_api_application) and register a new app. Set the Type to Service. Make note of the Client ID and Client Secret.
  2. Make a copy of my example project
  3. Open the Script Editor from Tools > Script editor
  4. Go to Utilities/Project.gs and set up the following variables:
    • acceloDomain: set this to your Accelo instance subdomain (e.g. company, if your deployment is at https://company.accelo.com)
    • channels: There are 3 channel options to set, 2 different types of requests, plus a blocklist channel. Get the Channel ID for the channel you wish the messages for that request type to be posted in by copying the link to that channel and finding the ID in the URL. If your request types in Accelo are different, simply change the keys in the channels object to match.
    • webAppSecret: Create a random secret. You'll need to set this as token= when you're calling your web app from Slack or Accelo
    • slackBotToken: The Bot Token from your Slack app
    • acceloUsername: the Client ID from your Accelo app
    • acceloPassword: the Client Secret from your Accelo app
  5. Manually run initialSetup() to save your secrets to the Script Props. Then delete them from the function so they aren't visible in your code.
  6. initialSetup() also runs matchUsernames() to match up your Accelo users to Slack users. This function matches based on email, so make sure your users' Slack and Accelo emails are the same. Once this function is run, it creates a time-based trigger to automatically run itself every day, so when you onboard or offboard a new user it will match their accounts.
  7. initialSetup()also runs getAcceloAccessToken(), which calls the Accelo API to exchange your username and password for an access token. This function automatically sets a trigger to get a new access token 12 hours before your old one expires.
  8. Deploy your script as a web app and copy the URL. Set Execute as to your email and Who can access to Anyone. If you make any changes to the code, you'll need to edit the deployment and publish as a new version in order for your changes to be implemented for the web app.

Deploy Web App

  1. Go back to Slack, and change the Interactivity URL to your published web app URL and webAppSecret as the token=
  2. Go to your Accelo webhooks settings page (https://YOUR_SUBDOMAIN.accelo.com/?action=list_webhook_subscriptions&target=list_webhook_subscriptions) and create two new webhooks:
    • Event: Request created

      • Payload URL: https://script.google.com/macros/s/YOUR_SCRIPT_ID/exec?token=YOUR_WEB_APP_SECRET&app=accelo&type=request_created
      • Content Type: application/json
      • Secret: none
    • Event: Request status updated

      • Payload URL: https://script.google.com/macros/s/YOUR_SCRIPT_ID/exec?token=YOUR_WEB_APP_SECRET&app=accelo&type=request_status_updated
      • Content Type: application/json
      • Secret: none

Accelo Webhooks

  1. Click Test on the Request Created webhook and enter a valid Request ID. The first time you test, it won't send anything to Slack, but rather it should add itself to the channel you set for that request type. Test again, and it should send the message.
  2. Profit.

Accelo API reference: https://api.accelo.com/docs

Google Apps Script reference: https://developers.google.com/apps-script/reference/spreadsheet/spreadsheet-app

Created by Ella Hansen for Ignition, Inc., a California corporation https://www.ignitionit.com

accelobot's People

Contributors

ella-ignition avatar

Stargazers

 avatar  avatar  avatar  avatar

Forkers

vjlumens

accelobot's Issues

No message in channel

hi @ella-ignition

Great tool is exactly what ive been looking for! Ater seeing the post in Accelo community today I followed your instructions and its great but I can seem to get anythng appeaing in Slack the project has no issues when its run in GAS

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.