Introduction: Forward Gmail Alerts to Slack
I have a lot of integrations with different services being a big fan of Slack. Keeping all stuff in one place is very convenient for me.
Apart from Slack, I use the Cloud4RPi IoT service for my devices. This cloud platform sends alert notifications in emails. Let me describe how to forward the Cloud4RPi alerts into a Slack channel.
Step 1: Configure IFTTT Applet
Since there is no direct way to forward emails into Slack, I use IFTTT, which is a great tool for linking different services. Its applet called Post labeled Gmail messages into a Slack channel is right what I needed here since my mailbox is hosted by Gmail (if you don’t have one, you can create a Google Account or find a similar applet).
The applet configuration is quite easy, I won’t describe it in detail. When the applet is configured, it automatically forwards all incoming messages with the specified label into Slack.
Step 2: Setup Gmail Label and Filter
It’s time to setup Gmail in order to set correct labels to alert emails from the Cloud4RPi service. Managing labels and creating the rules to filter your emails should be easy.
First, create a new label with the name you specified in the IFTTT applet (e.g. ‘Slack’).
After that, create a filter with the required parameters:
- Set firstname.lastname@example.org in the ‘From’ field.
- Set ‘Mark as read’ options.
- Check ‘Apply the label’ and select the existing ‘Slack’ label.
Hit ‘Create filter’ to complete the operation.
When the filter is active, Gmail automatically applies the ‘Slack’ label to emails from Cloud4RPi and marks them as read.
After that, IFTTT grabs messages with that label and forwards them to Slack.
Step 3: Conclusion
We have a be nice policy.
Please be positive and constructive.