Advanced Action Flows – Part 6. How to send notifications to email

Important: Even though this flow works in theory, in practice this type of usage is currently blocked by most email providers. We cannot help with issues relating to using this flow.
This tutorial will guide you through the process on how to define a action flow to send email to an user when there is an enter event to a defined geofence. This could come in handy when you want to be notified whenever an valuable customer enters your shop, restaurant or any other social gathering. We are going to have two geofences one defined at the entrance of the shop and one at the exit door. In this example, the geofences are called: Entrance Geofence and Exit Geofence. 


  • Creation of Places, Floors , Departments and Geofences.
  • The portal is connected to an app, so that you can actually get some push messages sent.

Step 1 : Import the following piece of code into the action flow clipboard from top right corner.

[{"id":"64b3bf79.f09c4","type":"switch","z":"fb2bdcc1.99e3c","name":"Check the geofence","property":"data.geofence","propertyType":"msg","rules":[{"t":"eq","v":"Entrance Geofence","vt":"str"},{"t":"eq","v":"Exit Geofence","vt":"str"}],"checkall":"false","outputs":2,"x":228,"y":444,"wires":[["974bef3b.ed3ef"],["5d96f5e4.c04fdc"]]},{"id":"5d96f5e4.c04fdc","type":"function","z":"fb2bdcc1.99e3c","name":"Email Store Manager on EXIT","func":"msg.payload = \"Your Visitor has left\";\nreturn msg;","outputs":1,"noerr":0,"x":547,"y":577,"wires":[["1416cab6.d040b5"]]},{"id":"974bef3b.ed3ef","type":"function","z":"fb2bdcc1.99e3c","name":"Email Store Manager on Entry","func":"msg.payload = \"There is is your VIP customer\";\nreturn msg;","outputs":1,"noerr":0,"x":543,"y":360,"wires":[["1416cab6.d040b5"]]},{"id":"115ae8f.12fb617","type":"switch","z":"fb2bdcc1.99e3c","name":"Check the event type","property":"event","propertyType":"msg","rules":[{"t":"eq","v":"enter","vt":"str"},{"t":"eq","v":"exit","vt":"str"}],"checkall":"false","outputs":2,"x":241,"y":259,"wires":[["64b3bf79.f09c4"],["862ca4be.237a28"]]},{"id":"1416cab6.d040b5","type":"e-mail","z":"fb2bdcc1.99e3c","server":"","port":"465","name":"","dname":"Send message to the Store Manager","x":850,"y":504,"wires":[]},{"id":"7e4010eb.6a9d6","type":"proximiio-event-receiver","z":"fb2bdcc1.99e3c","delete_event":true,"x":212,"y":134,"wires":[["639b3611.e1ecd8","115ae8f.12fb617"],[]]},{"id":"639b3611.e1ecd8","type":"debug","z":"fb2bdcc1.99e3c","name":"Debug","active":true,"console":"true","complete":"data.visitor_id","x":521,"y":119,"wires":[]},{"id":"862ca4be.237a28","type":"debug","z":"fb2bdcc1.99e3c","name":"Debug","active":true,"console":"false","complete":"true","x":463,"y":219,"wires":[]}]


Step 2 : Once the above code is imported the action flow would look like below .

Here’s the full walk-through of each of the steps and what’s happening in the action flows: Event Receiver
This node listens for visitors entering or exiting any of the defined geofences. When a proximity event occurs, the node get’s triggered and it will pass all the event data as an output payload.

Switch node
A Switch node can be used to segment the action flow based on the event type, department and a lot of other properties as well. You can check out all the properties from our REST API documentation. In this case we’re reacting only to “enter” events.

Switch node #2
Another Switch node will be used to determine, which geofence was entered. Double click on “Check Geofence” switch node and change the two entries to match with the name of your geofences.

Function node
Function node allows you to use JavaScript to add custom logic which might not be possible with other nodes. Here we are going to send the message in an email.  We are having two function node with two different messages to be sent as email to the defined email address.  The content of the message is what passed as the payload in the function node. Whenever there is an enter event to either one of the geofence the appropriate message is send in the email. 

Email Node
Email Node sends the mg.payload as the content of the email. The default message recipient can be configured in the nodes .  If you are using gmail to send the email, there might be some restrictions. Please follow the link here to resolve the issues in case you see a failure in sending the mail. The first email address that you see ’’ is the address to which the email has to be sent. Make sure you configure it with the correct email id and password.


Step 3: Deploying the action flow : You can deploy the action flow from the top right corner of the editor. Usually it’s good idea to select the first option “Full”.

Deploying the action flow

About Annina Koskiola

CEO and Co-founder of Loves exploring new ways for technology to intertwine with our everyday lives. Passion for history, traveling, eating and the Valais Blacknose sheep.