It is possible to send SMS via a Custom Step by using the IoT Insights Messaging REST API. This API encapsulates
the Mailjet. But only the Mailjet Send V4 API is available via the Messaging REST API. In the following it will be referenced as Messaging REST API.
The java and python examples illustrate how this Messaging REST API should be used.
The code examples provided for Java or Python are explained in detail in the following. They can be customized according to your needs.
Java example
| This is the java class providing an example to send a SMS. The name of the class can be changed according to your needs in the | YES |
| In the manifest, you configure which java class is used for the startup. | YES |
| Unlike the Python example, all required dependencies are downloaded locally. When building the artifact with our maven plugin, the dependencies specified in the | YES |
Python example
| In the manifest, you configure which script file is used for the startup. | YES |
| This is the Python script serves as example for sending a SMS. In order to use this example in the custom step, move it to the | YES |
| Add dependencies to this file according to the imported modules of All packages on the pypi.org website are available to list them here, as long as they run on a Linux Ubuntu 18.04 operating system. | YES |
In the examples a project specific URL suffix must be adapted. Replace <project-id> with your concrete project ID.
/messaging-proxy/v1/messaging/<project-id>/sendSmsEnvironment Variables
Following environment variables, which are provided by the Processing Pipeline App automatically, must be referenced in the custom code:
SMS_API_RESTURL: The base URL of the Messaging REST API.
SMS_API_USERNAME: The username for the Messaging REST API.
SMS_API_PASSWORD: The password for the Messaging REST API.
Payload for Sending SMS
A HTTP POST request for sending an SMS via the Messaging REST API should be a JSON document and compliant to the SMS Mailjet REST API. Following structure serves as example:
{ "From": "IoTInsights", "To": "+1234567890", "Text": "Hello, this is an SMS message"}