Integrations

Integrations are connections to external MQTT brokers, Pub/Sub messaging suppliers or other third-party web services. These connections can then be used to trigger Workflows and/or output messages from your application.

Viewing Integrations

Integrations List

View your application’s integrations under Integrations in the Application menu bar. Icons next to each integration indicate its last known connection status.

Click an integration’s name in the list to view its configuration, make edits or view workflows associated with the integration.

Creating an Integration

Add Integration

From the Integrations list page, click “Add Integration” in the top right corner. This will take you to a page where you will be able to choose which type of integration to create.

Integration Types

Integration Settings

Integration Common Config

Every integration requires a name, and you may also disable the integration by unchecking the Enabled checkbox. When editing an existing integration, you may also re-check its connection status from the settings page if you have editor permissions for the application.

Beyond that, the configuration for an integration varies wildly depending on its type.

Templating

Integration Templating

Integration configurations support templating from your application globals.

Note: If a template is provided for a configuration field, it must resolve to a valid value in order to save the integration.

MQTT

Setting up an MQTT broker integration allows you to trigger workflows whenever the integration receives a message; it also allows you to publish messages to the broker via a workflow.

There are a number of properties that must be defined when setting up the integration.

Integration MQTT Config

  • Protocol, Host and Port: Select mqtt://, mqtts://, ws:// or wss:// for the protocol. The port number will update to the default port for each of these protocols, but you may change this if necessary. For the host, enter the domain at which the broker is accessed.
  • Protocol Version: Choose whether to connect the integration over MQTT v3.1.1 (default) or MQTT v5. Some brokers will allow either option, but for most MQTT integrations, you must choose a specific version depending on what the broker supports.
  • Clean Session: Leave this checked to clear any previous session when connecting to the broker; uncheck it to pick up previous session data if it exists.
  • Client ID: Enter a client ID if the broker requires one. If you leave this field blank, Losant will automatically assign a client ID, which you may change at any time.
  • Authentication Method: There are three options to choose from, some of which require additional fields to be entered …
    • None: Provide no authentication information to the broker.
    • Username and password: Authenticate with the broker by providing a Username and a Password. This is the default authentication method.
    • Certificate: If a secure protocol is selected (mqtts:// or wss://), you can choose to authenticate by certificate, in which case you must provide a Private Key and a Certificate.
  • Topics: Enter one or more topics to subscribe to from this broker. Any workflows triggering off of this integration will fire anytime a message is received on one of these topics.
  • CA Certificate: If you selected a secure protocol for the connection, you will have the option to enter your own CA certificate. If you use a self-signed certificate or a certificate from a non-standard authority, you must provide the CA certificate from the authority so Losant can properly verify the connection.

Google Pub/Sub

A Google Cloud Pub/Sub integration allows you to trigger workflows off of messages going through your messaging middleware. It also allows you to publish to the service via a workflow.

Integration Google Pub/Sub Config

Google Pub/Sub Authentication

Choose a method for authenticating the Google Pub/Sub integration using the Credential Method dropdown:

  • Service Credential: If selected, this field is required:
  • Account Key JSON: If selected, these fields are required:
    • Account Key JSON: A JSON object in the format of a Service Account Key. There are a few validation rules on the object’s properties; it is recommended you copy the key directly from your Google Cloud account and paste it here. Note: This is only required if Account Key JSON is selected as a Credential Method. The key should have the Pub/Sub Editor role - roles/pubsub.editor - because it needs to be able to create subscriptions.

Project ID (Optional)

Project ID: This represents the ID of your Google Cloud Platform project. If left blank, the integration will use the default Project ID associated with your provided service account key.

Topics

Topics: Enter one or more topics to subscribe to. Any workflows triggering off of this integration will fire anytime a message is received on one of these topics. The topic you enter is the trailing part of the topic name from Google. For example, if your topic name is projects/myProjectName/topics/myTopic, you would enter myTopic. Note: It is not necessary to subscribe to a topic in order to publish to it in a Google Pub/Sub Output Node.

Particle

Particle now recommends using webhooks to send data to third-party services. While this integration is still supported, we suggest setting up a new Losant HTTP webhook for ingesting data from Particle.

See our How To Integrate Particle and Losant guide for more information.

A Particle integration allows you to trigger workflows off of events published from your Particle devices. It also allows you to call a Particle device function and receive a response via a workflow.

There are two properties that must be defined when setting up the integration.

Integration Particle Config

  • Access Token: This is the access token that Losant will use to communicate with Particle. You can get your access token from the “Settings” view in the Particle IDE.
  • Event Names: Enter one or more event names to subscribe to. Any workflows triggering off of this integration will fire anytime a message is received on one of these topics. If you append a *, the event name will be treated as a prefix match - so any events that start with the given name will match. In addition, an event name of just * will subscribe to all events. Note: It is not necessary to subscribe to an event in order to perform device function calls.

The other three fields in the Particle integration configuration are optional - Device Name or ID, Product Slug or ID, Org Slug or ID. These correspond to the deviceId, product, and org parameters on the underlying Particle Event Stream API endpoint. When the deviceId field is left blank, Losant will use the special keyword mine when connecting to Particle, to ensure that Losant only subscribes to events for your devices (as opposed to subscribing to the public events of any Particle device).

For a step-by-step walkthrough, please read the article How to Integrate Particle with Losant.

Azure Event Hubs

An Azure Event Hub integration allows you to trigger workflows by consuming events published to an Azure Event Hub.

Integration Event Hub Config

Azure Event Hubs Authentication

Choose a method for authenticating the Azure Event Hub integration using the Credential Method dropdown:

  • Service Credential: If selected, these fields are required:
    • Credential Name: A dropdown list of your Azure Service Credentials.
    • Host Name: The fully qualified domain name (FQDN) of the namespace that your Event Hub resides in.
  • Connection String: If selected, this field is required:
    • Connection String: This is a connection string scoped to either an event hub namespace, or to a specific event hub. You can create an event hub connection string through the Azure Portal. In order to properly connect with Losant, the access policy associated with the connection string must have Send and Listen permissions.

Event Hub Config

  • Event Hub Name: This is the name of the event hub to consume from and send to.
  • Consumer Group: This is the name of the consumer group used to consume and send events.

Partition Keys (Optional)

Partition Keys: This allows you to filter the events that this integration receives. Only events with a specified partition key will fire an Azure Event Hub Trigger. If no partition keys are configured, the integration will receive all events consumed from the event hub.

Note: It is not always recommended to use partition keys for your event hub implementation. Read more about partition keys and their recommended usage from Azure.

Amazon SQS

An Amazon Simple Queue Service (SQS) integration allows you to trigger workflows whenever an integration receives an Amazon SQS message.

Integration Amazon SQS

SQS Queue URL

SQS Queue URL: The URL associated with the SQS queue.

Amazon SQS Authentication

Choose a method for authenticating the Amazon SQS integration using the Credential Method dropdown:

  • Service Credential: If selected, this field is required:
  • Enter Connection Info: If selected, these fields are required:
    • AWS Region: The AWS Region where the SQS queue is located.
    • AWS Access Key ID: An AWS Access Key ID that Losant will use alongside the AWS Secret Access Key to authenticate the connection to your SQS queue. You can create an Access Key for an IAM user in the AWS IAM console. In order to properly connect with Losant, the IAM policy associated with the IAM user must have sqs:SendMessage and sqs:ReceiveMessage permissions.
    • AWS Secret Access Key: An AWS Secret Access Key that Losant will use alongside the AWS Access Key ID to establish the SQS connection.

Using Integrations

Integration Example Workflow

Setting up integrations serves two purposes: triggering workflows and outputting messages. Both of these goals are accomplished using Losant's workflow engine. For more information, check out your integration's corresponding nodes:

Messages received from your integrations count against your payload limits, so make sure to only subscribe to topics that you are actually using.

Integrations are throttled to 20 messages per second.

Deleting an Integration

An integration can be deleted by clicking the “Delete” icon next to any item on the list page, or by clicking the “Delete” button in the footer of an integration’s edit page.

Delete Integration

When deleting an integration, you also have the option of deleting any workflows triggered by that integration. Note that this action deletes any workflow with a trigger matching this integration. If you wish to save your workflows and change out their triggers, or if the workflows are triggered by multiple conditions and you wish to retain them, you should leave this option unchecked.

Examples

Was this page helpful?


Still looking for help? You can also search the Losant Forums or submit your question there.