diff options
Diffstat (limited to 'adapters/messaging/ntfy.go')
-rw-r--r-- | adapters/messaging/ntfy.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/adapters/messaging/ntfy.go b/adapters/messaging/ntfy.go index 837c01b..9c68f3a 100644 --- a/adapters/messaging/ntfy.go +++ b/adapters/messaging/ntfy.go @@ -17,7 +17,15 @@ func SendNtfy(topic string, ntfyEndpoint string) Continuation { log.Printf("fren name for message %v is not ntfy so we wont send it there", message) return success(message) } - encodedMsg := fmt.Sprintf(`{"message": "%s", "topic": "%s"}`, utils.Quote(message.Message), utils.Quote(topic)) + content := strings.SplitN(message.Message, " ", 2) + if len(content) < 2 { + log.Printf("no topic %s", content) + return failure(message) + } + + topic := content[0] + msg := content[1] + encodedMsg := fmt.Sprintf(`{"message": "%s", "topic": "%s"}`, utils.Quote(msg), utils.Quote(topic)) url := ntfyEndpoint payload := strings.NewReader(encodedMsg) |