In this example, we configure an HTTP connection that publishes twin events to AWS SNS (Simple Notification Service).


To follow this example you will need:

  • A Bosch IoT Things service subscription
  • An AWS SNS topic
  • An AWS IAM user with access to SNS

Create the connection

  • Click Go to Dashboard in the row of your Things instance, which will manage the connection.
  • On the Things dashboard open the tab Connections/Integrations.
  • Click Create your first connection, or Add in case you have one already.
    • Select HTTP from the categories.
    • Give the connection a name. Setting a name is required.
    • Click the Continue button.

Configure credentials

  • Scroll to the Coordinates section.
  • Choose hmac as the credential type.
  • Choose aws4-hmac-sha256 as the algorithm.
  • Enter the AWS region of your SNS topic, e.g. eu-central-1.
  • Enter sns as the AWS service name.
  • Enter the access key of the SNS user.
  • Enter the secret key of the SNS user.


Configure the hostname

  • Scroll to the Connection coordinates section.
  • Enter the hostname of your SNS: sns.<aws-region>


Add a target

  • Scroll to the Targets section.
  • Click the Add target button.
  • Choose GET as the HTTP verb.
  • Enter / as the HTTP path.
    Payload mapping will compute the query parameters for SNS.
  • Add an authorization subject, e.g. integration:<solution-id>:sns.
  • Check Thing twin events under Topics to publish on address.
  • Click Save new target.


Configure payload mapping

  • Scroll to the Payload mapping section.
  • Check Enable custom JavaScript-based payload mapping.
  • Change the outgoing payload mapping to compute the query parameters of SNS, and set the query string via the special header http.query.
    Set the variable topicArn to the ARN of the SNS topic.
function mapFromDittoProtocolMsg(namespace, name, group, channel, criterion,
                                 action, path, dittoHeaders, value, status, extra) {

  let topicArn = '<sns-topic-arn>';

  let textPayload = JSON.stringify(Ditto.buildDittoProtocolMsg(namespace, name,
      group, channel, criterion, action, path, dittoHeaders, value, status, extra));

  let query = 'Action=Publish&Message=' + encodeURIComponent(textPayload) +
      '&Subject=ThingModified&TopicArn=' + encodeURIComponent(topicArn);

  let headers = {"http.query": query};

  return Ditto.buildExternalMsg(headers,'',null,'text/plain');
  • Click the Create button at the top right to save the connection.

Authorize the connection for twin events

Follow the steps “Create a Hello World thing” and “Add the authorization subject of the connection to the policy” on the Hub-to-Things connection tutorial to authorize the SNS connection to receive twin events.

Remember to use the authorization subject of this connection in the policy, e.g. integration:<solution-id>:sns.

Subsequent twin modifications will publish messages on the SNS topic and notify its subscribers.

Corporate information Data protection notice Legal information Support Free plans