diff --git a/notifications/core-spi/src/main/kotlin/org/opensearch/notifications/spi/model/MessageContent.kt b/notifications/core-spi/src/main/kotlin/org/opensearch/notifications/spi/model/MessageContent.kt index f10b6ccc..f577ad6a 100644 --- a/notifications/core-spi/src/main/kotlin/org/opensearch/notifications/spi/model/MessageContent.kt +++ b/notifications/core-spi/src/main/kotlin/org/opensearch/notifications/spi/model/MessageContent.kt @@ -23,10 +23,16 @@ class MessageContent( init { require(!Strings.isNullOrEmpty(title)) { "title is null or empty" } - require(!Strings.isNullOrEmpty(textDescription)) { "text message part is null or empty" } + require(!Strings.isNullOrEmpty(textDescription) || !Strings.isNullOrEmpty(htmlDescription)) { + "text message part and html message part are both null or empty" + } } fun buildMessageWithTitle(): String { - return "$title\n\n$textDescription" + return if (htmlDescription != null) { + htmlDescription + } else { + "$title\n\n$textDescription" + } } } diff --git a/notifications/core-spi/src/main/kotlin/org/opensearch/notifications/spi/model/destination/TelegramDestination.kt b/notifications/core-spi/src/main/kotlin/org/opensearch/notifications/spi/model/destination/TelegramDestination.kt deleted file mode 100644 index 5dfd957b..00000000 --- a/notifications/core-spi/src/main/kotlin/org/opensearch/notifications/spi/model/destination/TelegramDestination.kt +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - */ - -package org.opensearch.notifications.spi.model.destination -/* -This class holds the contents of a Telegram destination - */ -class TelegramDestination( - val token: String, - val chatId: Long, - val url: String = "https://api.telegram.org/bot$token/sendMessage?chat_id=$chatId" -) : WebhookDestination(url, DestinationType.TELEGRAM)