Open documentation for releases before 2.0
ThingsBoard Professional Edition with White-labeling and Platform Integrations Learn More

SNS Plugin

Overview

SNS plugin is responsible for sending messages to Amazon Web Services Simple Notification Service topics triggered by specific rules

Configuration

SNS Plugin has the following configuration parameters:

Access Key ID and Secret Access Key are the credentials of an AWS IAM User with programmatic access. More information on AWS access keys can be found here

Region must correspond to the one in which the SNS Queue(s) are created. Current list of AWS Regions can be found here

Server-side API

This plugin does not provide any server-side API.

Example

In this example, we are going to demonstrate how you can configure this extension to be able to send a message to an SNS Topic every time new telemetry message for the device arrives.

Prerequisites before contining Kafka extension configuration:

The information on how to create SNS Topic can be found here

SNS Plugin Configuration

Let’s configure SNS plugin first. Go to Plugins menu and create new plugin:

image

image

Make sure to replace <$YOUR_ACCESS_KEY_ID> and <$YOUR_SECRET_ACCESS_KEY> placeholders with the actual values and set the right region.

Click on ‘Activate’ plugin button:

image

SNS Rule Configuration

In order to create SNS Rule, go to Rules screen and click ‘Add New rule’ button.

image

Add filter for POST_TELEMETRY message type:

image

Click ‘Add’ button to add filter.

Then select ‘SNS Plugin’ in the drop-down box for the Plugin field:

image

Add action that will send temperature telemetry of device to the particular SNS Topic:

image

Click ‘Add’ button and then activate Rule.

image

Creating Email SNS Subscription

SNS is a push-based service, so we need to create a subscription in order to receive messages from it. In AWS console under SNS Dashboard, go to Topics, select your topic, then click Action -> Subscribe to topic. In the window that appears, select Protocol: Email amd enter your email address:

image

Sending Temperature Telemetry

Now you can send Telemetry message that contains ‘temp’ telemetry for any of your devices:

{"temp":88.2}

Here is an example of a command that publish single telemetry message to locally installed ThingsBoard:

mosquitto_pub -d -h "localhost" -p 1883 -t "v1/devices/me/telemetry" -u "$ACCESS_TOKEN" -m "{'temp':88.2}"

Now you should receive an email with the telemetry data in your mailbox:

image