You can receive Openpath notifications in Slack by setting up Openpath webhooks and creating a custom Slack app. This configuration requires the use of the Openpath Rules Engine’s JSON editor.
To create a custom Slack app:
Create a custom app following Slack’s instructions
Enable Incoming Webhooks for the custom app
Create an Incoming Webhook and select which Slack channel to post to
Under app settings, look for Webhook URLs for Your Workspace, then copy the Webhook URL
Create a rule using JSON in Openpath:
Go to https://control.openpath.com/login and log in
Go to Configurations > Rules Engine, then click Create Rule
Enter a name and description for the rule, select a Trigger Type, then select an Event
In this example we want the rule to trigger on Entry Unlock events
On the right side of the page, check Use JSON Editor
Create a rule using JSON, using the Slack app’s Webhook URL. Your rule should look something like this:
“entry.unlocked” is the event type that will trigger the rule:
{ "name": "Send Openpath event to Slack", "description": "Notify Slack when front foor unlocks", "trigger": { "properties": { "event": { "enum": [ "entry.unlocked" ] },
Replace “####” with entry IDs to only trigger the rule when specific entries unlock
"data": { "required": [ "entryIds" ], "properties": { "entryIds": { "contains": { "enum": [ #### ] } } } } } },
Replace the URL below with your app’s Webhook URL
"variables": [ { "name": "base_url", "value": "https://hooks.slack.com/services/XXXXXXXXXXXXXXXXXXXXXXXXXX" } ], "curlOpts": { "followLocation": false, "maxRedirs": 10, "autoReferer": true, "ssl_verifyPeer": 0, "connectTimeout": 10, "timeout": 10, "httpHeader": [ "Content-type:application/json" ] },
“postFields” is the data that will be sent to the specified Slack channel. If you’d like to format this differently, refer to Slack’s documentation. For an example of what this notification looks like, see below.
Note: To include a link to your organization’s Entry Activity Report, replace the ###
in /o/###/reports
in the example below with your OrgId.
"requests": [ { "curlOpts": { "post": 1, "postFields": "{\"username\":\"openpath\",\"icon_emoji\":\":openpath:\",\"channel\":\"webhooktest\",\"text\":\"{{event.event}} {{event.timestamp}} {{event.data.org.name}} {{event.data.entries.0.name}} Unlocked using {{event.data.requestType}} {{event.data.connectionType}} by {{event.data.userId}} at {{event.data.requestTimestamp}}\",\"attachments\":[{\"color\":\"warning\",\"title\":\"Click here to see Entry Report\",\"title_link\":\"https://control.openpath.com/o/###/reports/entryActivity\"}]}", "url": "{{base_url}}" } } ] }
Openpath notification in Slack example
0 Comments