Webhooks example: Send arrival notifications with Slack

In addition to sending guest arrival notifications via email, text, and push notifications, you can use webhooks to alert your employees in Slack.

To send a guest arrival notification to your employees using Slack, you will need active Zapier and Slack accounts to configure this integration.

Employees will be matched on their email addresses, please make sure that the email address used in MRI OnLocation matches the one used in Slack.

This process involves two different systems across four steps, each step will note which system you need to be working in.

Step 1: Create a webhook URL in Zapier

To get started you need to create a webhook URL in your Zapier account for OnLocation to send information to.

Log into your Zapier account, then:

  1. Click Make a Zap!

    2019-05-24_14-49-58.png
  2. Select Webhooks by Zapier as your Trigger App.

    2019-05-24_14-51-54.png
  3. Select Catch Hook.

    2019-05-24_14-52-28.png
  4. Click Save + Continue.

This will generate the URL where data will be sent from OnLocation. Click Copy next to the URL to easily paste it into OnLocation.

2019-05-24_14-53-26.png

Step 2: Add the webhook URL in OnLocation

Now you have your webhook URL, you need to add it into your OnLocation account as a destination to send data.

Log into OnLocation as the Account Owner or IT Support user, then:

  1. Go to Tools > Accounts.
  2. Select Integrations from the left-hand menu.
  3. Select the Webhooks integration.
  4. Click Settings.
  5. Click Create a New Webhook.
  6. Add the Webhook Name.
  7. Enter the Webhook URL (you should be able to paste this from your copied URL in Zapier).
  8. Select the 'Method' POST.
  9. Select the 'Content Type' JSON.
  10. Click Save.

    Webhooks-Slack-1.png
You don’t have to enter any optional or trigger settings for this webhook.

Step 3: Create a Webhook Trigger

Now that we have added the webhook URL to your OnLocation account you can set up a trigger to tell the system where and when to send data.

In OnLocation:

  1. Go to Locations, then select the location from the drop-down list.
  2. Select Triggers.
  3. Click Create a New Trigger.
  4. Enter a Trigger Name.
  5. Set the 'Trigger Status' to Active.
  6. Set the 'Trigger Event' to Visitor Sign In.
  7. Click Next.
  8. (Optional) Enter any 'Trigger Rules' that you may want to narrow down when OnLocation will send the arrival notification through Slack.
  9. Click Next.
  10. Click Create a New Action.
  11. Select Webhook – Triggers a Webhook URL from the drop-down menu.
  12. Select your Zapier webhook from the drop-down menu.
  13. Select the 'Data mode' as Full.
  14. Click Preview.
  15. Select a record from the drop-down menu to test the webhook with.
  16. Click Send Data.

    Information should be presented under the Response Data including {"status": "success"… This means the test has worked.
  17. Click Save & Close.

Step 4: Create the Action to Find User in Slack

Now your trigger is set up it will start sending visitor data to Zapier whenever a visitor signs in, depending on your trigger rules. The next step is to tell Zapier how to find the employee in Slack.

In Zapier:

  1. Click Ok, I did this.

    2019-05-24_15-19-24.png

    You will be able to review the data that was sent to Zapier in your test.
  2. Click Continue.

    2019-05-24_15-20-27.png
  3. Click the Your Zap currently lacks an Action step. Add one now! link.

    2019-05-24_15-20-48.png
  4. Search for Slack and select it.

    2019-05-24_15-21-36.png
  5. Select Find User by Email.

    2019-05-24_15-24-09.png
  6. Click Save + Continue.

    If you have a Slack account already connected to Zapier, you can choose this and skip to step 12.
  7. Otherwise, click Connect an Account.

    A new window will open to your Slack login.
  8. Enter your workspace URL.
  9. Click Continue.
  10. Sign into your account.
  11. Click Authorize.

    You will be taken back to the Zapier window.
  12. Click Save + Continue.

    2019-05-24_15-25-08.png
  13. Next to the email field, click the Insert a Field button.
  14. Select Visiting Staff Email.

    2019-05-24_15-29-48.png
  15. Click Continue.
  16. Click Fetch & Continue.

    2019-05-24_15-34-21.png

Step 5: Create the Action to Send a Slack Message

Now Zapier knows how to find employees in Slack, it needs to be told what to send to Slack when a visitor arrives.

In Zapier:

  1. Click Add a Step.

    2019-05-24_15-37-44.png
  2. Select Slack.

    2019-05-24_15-38-13.png
  3. Select Send Direct Message.

    2019-05-24_15-38-36.png
  4. Click Save + Continue.
  5. Select your Slack account.
  6. Click Save + Continue.
  7. Under 'To Username' scroll to the bottom of the drop-down menu and select Use a Custom Value (advanced).

    2019-05-24_15-39-58.png
  8. Next to the 'Custom Value for To Username ID' field click the Insert a Field button.
  9. Select Find User by Email > ID.

    2019-05-24_15-40-25.png
  10. Under Message Text enter the notification to be sent through Slack using the placeholder fields to insert dynamic information about the visitor. For Example:

    2019-05-24_15-43-14.png
  11. Enter any optional information you want.
  12. Click Continue.
  13. Click Send Test To Slack to ensure it’s all working.

    2019-05-24_15-45-27.png
  14. Click Finish.
  15. Enter a Name.
  16. Set 'Your Zap Is' to On.

    2019-05-24_15-46-24.png