Update: Here is an alternate method if you prefer not to use the Mailparser service: https://slack.com/intl/en-au/help/articles/206819278-Send-emails-to-Slack

 

By integrating UniFi email alerts with Mailparser, we can extract the contents from those emails and then send a webhook to Slack’s API to create an alert in a Slack channel.

 

  1. First, configure UniFi to send email alerts to Mailparser and extract the data fields from the email template.

  2. Create the Slack channel that you want to use for the alerts. It can be public or private.

3. Log in to your Slack workspace at https://app.slack.com
4. Go to https://api.slack.com/apps?new_app=1 and create a new Slack app

 

5. You can update the App name and icon on the Basic Information page

 

6. Go to Features > Incoming Webhooks and Activate Incoming Webhooks. Next, create a new webhook and choose the channel you created in step 2. Copy the webhook URL.

 

7. In Mailparser, go to Webhook Integrations > Add New Integration > Generic Webhook

 

8. Use the following settings. Replace the Target URL with the webhook URL you copied in step 6.

 

Basic Options
Name: This can be anything, I used “Slack webhook to MSP Story #demo-hostifi-com”
Payload format: JSON
Target URL: https://hooks.slack.com/services/your-webhook-url-goes-here

 

Advanced Options
HTTP Verb: POST
Repeating Data Behavior: One request per email
Data Structure: Custom – provide your own template
Structure template: {“text”:”Site: {{site_name}}\nAlarm: {{alarm}}\nDevice: {{device_name}}\nURL: {{controller_url}}”}
Additional Headers: Leave empty

 

9. Click Save & Test. Check for any error messages.