Extending and Customizing Location Based Services
The geo extension feature that is used to monitor devices using location-based services can be extended or customized using output adapters available in WSO2 Data Analytics Server. The instructions below guide you through adding the SMS event publisher to your geofencing alert so that you can receive alerts to your phone via SMS instead of seeing alerts on the geofence UI screen.
Before you begin:
- Set up geofencing in WSO2 IoT Server.
- Set up an alert for a device. (The steps below demonstrate setting up SMS alerts for a GeoFence Exit Alert.)
Start the WSO2 IoT Server core and analytics profiles in that order.
- Access the WSO2 IoT Server analytics management console by navigating to the following URL: http://localhost:9445/carbon.
- Click on Event > Flow under the Manage section of the Main tab.
- You see an event flow diagram similar to the one shown below. Here you can see the event streams and event publishers of the alert you created.
You can add new custom output adapters or event publishers to the alert. - Click Event > Publishers under the Manage section of the Main tab.
- Click Add Event Publisher and fill in the required details for the SMS event publisher.
- Event Publisher Name -
SMSAlerts
- Event Source -
iot.per.device.stream.geo.AlertNotifications:`1.0.0
- Output Event Adapter Type -
sms
- Phone No -
<Enter_Your_Phone_Number>
Message Format -
text
Click Advanced to define custom output mappings based on the Message Format you selected. For more information on custom output mapping types, see Output Mapping Types.
This is a sample of a custom output mapping for the 'text' message format.Note that this phone is out of range {{information}} {{timeStamp}}.
- Event Publisher Name -
- Click Add Event Publisher. You have successfully set up SMS alerts for your geofence.
- Navigate to Event > Flow under the Manage section of the Main tab again. You will be able to see the SMS event publisher you added.
To try this out, take the enrolled device out of the geofence boundary. You will now receive an SMS alert for the geofence exit alert that you created.
You can also add any other output adapters available through WSO2 Data Analytics Server such as the Email Event Publisher. For more information, see Event Publisher Types in the WSO2 Data Analytics documentation.