Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion server/notification-providers/signal.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,15 @@ class Signal extends NotificationProvider {
const okMsg = "Sent Successfully.";

try {
let message = msg;

// Use template if enabled
Comment thread
CommanderStorm marked this conversation as resolved.
Outdated
if (notification.signalUseTemplate) {
message = await this.renderTemplate(notification.signalTemplate, msg, monitorJSON, heartbeatJSON);
}

let data = {
message: msg,
message: message,
Comment thread
CommanderStorm marked this conversation as resolved.
Outdated
number: notification.signalNumber,
recipients: notification.signalRecipients.replace(/\s/g, "").split(","),
};
Expand Down
44 changes: 44 additions & 0 deletions src/components/notifications/Signal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,48 @@
</p>
</div>
</div>

<div class="mb-3">
<div class="form-check form-switch">
<input v-model="$parent.notification.signalUseTemplate" class="form-check-input" type="checkbox" />
<label class="form-check-label">{{ $t("signalUseTemplate") }}</label>
</div>

<div class="form-text">
{{ $t("signalUseTemplateDescription") }}
</div>
</div>

<template v-if="$parent.notification.signalUseTemplate">
<div class="mb-3">
<label class="form-label" for="signal-template">{{ $t("Message Template") }}</label>
<TemplatedTextarea
id="signal-template"
v-model="$parent.notification.signalTemplate"
:required="true"
:placeholder="signalTemplatedTextareaPlaceholder"
></TemplatedTextarea>
</div>
</template>
</template>

<script>
import TemplatedTextarea from "../TemplatedTextarea.vue";

export default {
components: {
TemplatedTextarea,
},
computed: {
signalTemplatedTextareaPlaceholder() {
return this.$t("Example:", [
`
Signal Alert{% if monitorJSON %} - {{ monitorJSON['name'] }}{% endif %}

{{ msg }}
`,
]);
},
},
};
</script>
2 changes: 2 additions & 0 deletions src/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,8 @@
"Remove domain": "Remove domain '{0}'",
"Icon Emoji": "Icon Emoji",
"signalImportant": "IMPORTANT: You cannot mix groups and numbers in recipients!",
"signalUseTemplate": "Use custom message template",
"signalUseTemplateDescription": "If enabled, the message will be sent using a custom template. You can use Liquid templating to customize the notification format.",
"aboutWebhooks": "More info about Webhooks on: {0}",
"aboutJiraCloudId": "More info about Jira Cloud ID: {0}",
"see Jira Cloud Docs": "see Jira Cloud Docs",
Expand Down
Loading