| Name | Message Composer |
| Version | v1.0.0 |
| GitHub | weeve-modules/message-composer |
| authors | Jakub Grzelak |
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"
}
The following module configurations can be provided in a data service designer section on weeve platform:
| Name | Environment Variables | type | Description |
|---|---|---|---|
| Message Content | MESSAGE_CONTENT | string | Message content. Use double curly brackets to access labels from your data (i.e. to access data assigned to temperature label use {{temperature}}). |
| Message Label | MESSAGE_LABEL | string | Label to assign message to in the output JSON object. |
Other features required for establishing the inter-container communication between modules in a data service are set by weeve agent.
| Environment Variables | type | Description |
|---|---|---|
| MODULE_NAME | string | Name of the module |
| MODULE_TYPE | string | Type of the module (Input, Processing, Output) |
| EGRESS_URLS | string | HTTP ReST endpoints for the next module |
| INGRESS_HOST | string | Host to which data will be received |
| INGRESS_PORT | string | Port to which data will be received |
bottle
requests
Input to this module is:
{
"temperature": 12,
"volume": 375,
"deviceID": "hf238hf23h7",
"location": "Berlin"
}
Output of this module is (assuming Message Content is Device {{deviceID}} (in {{location}}) measured temperature {{temperature}} on {{utils.getDateAndTime}})
{
"alertMessage": "Device hf238hf23h7 (in Berlin) measured temperature 12 on 2022-09-25 15:35:17.31234"
}
Content type
Image
Digest
sha256:be8674ae2…
Size
48.5 MB
Last updated
over 3 years ago
docker pull weevenetwork/message-composer:v1.1.0