IBM Cloud Actions
An example integration where a Data Connector forwards events to an IBM Cloud Action.
Last updated
Was this helpful?
An example integration where a Data Connector forwards events to an IBM Cloud Action.
Last updated
Was this helpful?
This example uses a Data Connector to forward the events of all devices in a project to an . When receiving the HTTPS POST request, our action will verify both the origin and content of the request using a , then decode the data.
The following points are assumed.
You have a of Project Developer or higher in your DT Studio project.
You are familiar with the and know how to .
You are familiar with the documentation.
While there are many advantages to using a local environment for development, this guide will use the browser portal to minimize setup requirements.
In the , create and deploy a new Action with one of the following runtimes.
Python 3.11
Node.js 16
Parameters are default values stored safely on IBM's servers. Once a request is received, it is merged with the incoming dictionary. Add a new parameter with the following Name and Value.
Name: DT_SIGNATURE_SECRET
Value: A unique password. We will use it later, so write it down.
Under the Endpoints tab, toggle Enable as Web Action and Raw HTTP handling. Copy the HTTP Method URL and save it for later as we will use it when configuring our Data Connector.
Endpoint URL: The HTTP Method URL found in the previous step.
Signature Secret: The value of DT_SIGNATURE_SECRET parameter set earlier.
Depending on your integration, it can also be smart to disable the event types you are not interested in. For instance, the NetworkStatusEvent is sent every Periodic Heartbeat and will by default be forwarded by the Data Connector if not explicitly unticked.
If instead the Error counter increments, a response containing a non-200 status code is returned.
Verify that the Data Connector endpoint URL is correct.
Your sensor data is now in the IBM Cloud environment, and you can start using it in their various services. Fortunately, IBM has some well-documented guides to get you started.
A database should be tailored to each specific use case. However, if you're uncertain, PostgreSQL (Postgres) is a good place to get started. The following guides will show you how to create a new Postgres database, then connect your Cloud Action to execute queries.
Once deployed, replace the code of your new Action with that matching your runtime. The implementation is explained in detail on the page.
To continuously forward the data to our newly created Cloud Action, a Data Connector with almost all default settings is sufficient. If you are unfamiliar with how Data Connectors can be created, refer to our guide. The following configurations should be set.
If the integration was correctly implemented, the Success counter for your Data Connector should increment for each new event forwarded. This happens each or by touching a sensor to force a new event.
IBM Cloud provides a host of tools that can be used to . Check the logs for any tracebacks that could explain why an error is returned.
.
.