Sign inSign up

weevenetwork/message-composer

By weevenetwork

Updated over 3 years ago

Image
0

937

weevenetwork/message-composer repository overview

Message Composer

NameMessage Composer
Versionv1.0.0
GitHubweeve-modules/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,
    "deviceID": "hf238hf23h7",
    "location": "Berlin"
}

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

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

then the output of the module will be:

{
    "alertMessage": "Device hf238hf23h7 (in Berlin) measured temperature 12 on 2022-09-25 15:35:17.31234"
}

Environment Variables

Module Specific

The following module configurations can be provided in a data service designer section on weeve 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 weeve Agent on the edge-node

Other features required for establishing the inter-container communication between modules in a data service are set by weeve 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,
    "deviceID": "hf238hf23h7",
    "location": "Berlin"
}

Output

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

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

Tag summary

Content type

Image

Digest

sha256:be8674ae2

Size

48.5 MB

Last updated

over 3 years ago

docker pull weevenetwork/message-composer:v1.1.0