Get interactive Slack notifications every time a new request is created or updated in Accelo!
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.
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.
- 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.
- Install the app to your workspace and make note of the Bot Token. We'll need to add this to the Script Properties later.
- 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. - Make a copy of my example project
- Open the Script Editor from Tools > Script editor
- 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 athttps://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 astoken=
when you're calling your web app from Slack or AcceloslackBotToken
: The Bot Token from your Slack appacceloUsername
: the Client ID from your Accelo appacceloPassword
: the Client Secret from your Accelo app
- 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. initialSetup()
also runsmatchUsernames()
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.initialSetup()
also runsgetAcceloAccessToken()
, 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.- 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.
- Go back to Slack, and change the Interactivity URL to your published web app URL and webAppSecret as the token=
- 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
- Payload URL:
-
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
- Payload URL:
-
- 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.
- 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