Sign inSign up

beetaone/message-composer

By beetaone

Updated almost 2 years ago

Image
0

194

beetaone/message-composer repository overview

Message Composer

NameMessage Composer
Versionv1.1.0
Dockerhub Linkbeetaone/message-composer
authorsJakub Grzelak

Description

This module enables a customized composition of messages, in example alert messages that can be later passed to the next module like Slack Alert which would further pass it to the selected Slack endpoint channel. To include some data in the message use double curly brackets and provide a desired label like {{ label_name }}. To use one of the supported utils functions to add extra information to your message, use double curly brackets and prefix utils. before the name of the function you want to apply {{ utils.function_name }} (see Supported Utils Functions section below).

For instance, if we expect to receive data in the following format:

{
    "temperature": 12,
    "volume": 375,
    "location": "Berlin"
}

and if we have our Message Label set to alertMessage and our Message Content variable is set to the following:

Device {{utils.getNodeName}} (in {{location}}) measured temperature {{temperature}} on {{utils.getDateAndTime}}

then the output of the module will be:

{
    "alertMessage": "Device Kunbus (in Berlin) measured temperature 12 on 2022-09-25 15:35:17.31234"
}
Supported Utils Functions
Function NameDescription
getNodeNameReturns the name of the node on which the module is running.
getNodeIDReturns the ID of the node on which the module is running.
getDateAndTimeReturns the current date and time in the following format: YYYY-MM-DD HH:MM:SS.mmmmmm.
getDateReturns the current date in the following format: YYYY-MM-DD.
getTimeReturns the current time in the following format: HH:MM:SS.mmmmmm.
getTimestampReturns the number of seconds since the Unix epoch.

Environment Variables

Module Specific

The following module configurations can be provided in a data service designer section on beetaone platform:

NameEnvironment VariablestypeDescription
Message ContentMESSAGE_CONTENTstringMessage content. Use double curly brackets to access labels from your data (i.e. to access data assigned to temperature label use {{temperature}}).
Message LabelMESSAGE_LABELstringLabel to assign message to in the output JSON object.
Set by the beetaone Agent on the edge-node

Other features required for establishing the inter-container communication between modules in a data service are set by beetaone agent.

Environment VariablestypeDescription
MODULE_NAMEstringName of the module
MODULE_TYPEstringType of the module (Input, Processing, Output)
EGRESS_URLSstringHTTP ReST endpoints for the next module
INGRESS_HOSTstringHost to which data will be received
INGRESS_PORTstringPort to which data will be received

Dependencies

bottle
requests

Input

Input to this module is:

  • JSON body single object, example:
{
    "temperature": 12,
    "volume": 375,
    "location": "Berlin"
}

Output

Output of this module is (assuming Message Content is Device {{utils.getNodeName}} (in {{location}}) measured temperature {{temperature}} on {{utils.getDateAndTime}})

  • JSON body single object, example:
{
    "alertMessage": "Device Kunbus (in Berlin) measured temperature 12 on 2022-09-25 15:35:17.31234"
}

Tag summary

Content type

Image

Digest

sha256:c253b03b7

Size

49.1 MB

Last updated

almost 2 years ago

docker pull beetaone/message-composer:v1.1.0