diff --git a/wazuh-notify-go/notification/discord.go b/wazuh-notify-go/notification/discord.go index 0360ad0..95d9cdb 100644 --- a/wazuh-notify-go/notification/discord.go +++ b/wazuh-notify-go/notification/discord.go @@ -42,12 +42,12 @@ func SendDiscord(params types.Params) { "**Threat level:** " + strconv.Itoa(params.WazuhMessage.Parameters.Alert.Rule.Level) + "\n" + "**Times fired:** " + strconv.Itoa(params.WazuhMessage.Parameters.Alert.Rule.Firedtimes) + "\n\n" + - "Priority: " + strconv.Itoa(params.Priority) + "\n" + - "Tags: " + params.Tags + "\n\n" + + "**Priority:** " + strconv.Itoa(params.Priority) + "\n" + + "**Tags:** " + params.Tags + "\n\n" + params.General.Click } - message := types.Message{ + message := types.DiscordMessage{ Username: params.General.Sender, Content: params.Mention, Embeds: []types.Embed{ diff --git a/wazuh-notify-go/notification/slack.go b/wazuh-notify-go/notification/slack.go index e2cdf96..2e5336a 100644 --- a/wazuh-notify-go/notification/slack.go +++ b/wazuh-notify-go/notification/slack.go @@ -3,7 +3,6 @@ package notification import ( "bytes" "encoding/json" - "fmt" "log" "net/http" "os" @@ -35,20 +34,22 @@ func SendSlack(params types.Params) { params.General.Click } else { embedDescription = "\n\n" + - "**Timestamp: **" + time.Now().Format(time.DateTime) + "\n" + - "**Agent:** " + params.WazuhMessage.Parameters.Alert.Agent.Name + "\n" + - "**Event id:** " + params.WazuhMessage.Parameters.Alert.Rule.ID + "\n" + - "**Rule:** " + params.WazuhMessage.Parameters.Alert.Rule.Description + "\n" + - "**Description: **" + params.WazuhMessage.Parameters.Alert.FullLog + "\n" + - "**Threat level:** " + strconv.Itoa(params.WazuhMessage.Parameters.Alert.Rule.Level) + "\n" + - "**Times fired:** " + strconv.Itoa(params.WazuhMessage.Parameters.Alert.Rule.Firedtimes) + + "*Timestamp:* " + time.Now().Format(time.DateTime) + "\n" + + "*Agent:* " + params.WazuhMessage.Parameters.Alert.Agent.Name + "\n" + + "*Event id:* " + params.WazuhMessage.Parameters.Alert.Rule.ID + "\n" + + "*Rule:* " + params.WazuhMessage.Parameters.Alert.Rule.Description + "\n" + + "*Description:* " + params.WazuhMessage.Parameters.Alert.FullLog + "\n" + + "*Threat level:* " + strconv.Itoa(params.WazuhMessage.Parameters.Alert.Rule.Level) + "\n" + + "*Times fired:* " + strconv.Itoa(params.WazuhMessage.Parameters.Alert.Rule.Firedtimes) + "\n\n" + - "Priority: " + strconv.Itoa(params.Priority) + "\n" + - "Tags: " + params.Tags + "\n\n" + + "*Priority:* " + strconv.Itoa(params.Priority) + "\n" + + "*Tags:* " + params.Tags + "\n\n" + params.General.Click } - message := fmt.Sprintf("{\"text\": %s}", embedDescription) + message := types.SlackMessage{ + Text: embedDescription, + } payload := new(bytes.Buffer) diff --git a/wazuh-notify-go/types/types.go b/wazuh-notify-go/types/types.go index 7e4453f..de951a9 100644 --- a/wazuh-notify-go/types/types.go +++ b/wazuh-notify-go/types/types.go @@ -32,7 +32,8 @@ type MarkdownEmphasis struct { Discord string `toml:"discord"` } -type Message struct { +// Discord +type DiscordMessage struct { Username string `json:"username,omitempty"` AvatarUrl string `json:"avatar_url,omitempty"` Content string `json:"content,omitempty"` @@ -44,3 +45,8 @@ type Embed struct { Description string `json:"description,omitempty"` Color int `json:"color,omitempty"` } + +// slack +type SlackMessage struct { + Text string `json:"text,omitempty"` +}