Skip to content

Commit

Permalink
✨ Allow to use custom query parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
MelaineGerard committed Dec 2, 2024
1 parent 71dcae5 commit 74f8d19
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,12 @@ def self.generate_discord_message(post)
end

def self.trigger_notification(post, channel, rule)
# Splitting the URL in order to support custom query parameters (e.g. thread_id=1234)
splitted_url = channel.data["webhook_url"].split("?")
webhook_url = "#{splitted_url[0]}?wait=true"
# Adding ?wait=true means that we actually get a success/failure response, rather than returning asynchronously
webhook_url = "#{channel.data["webhook_url"]}?wait=true"

webhook_url += "&" + splitted_url[1] if splitted_url.length > 1
message = generate_discord_message(post)
response = send_message(webhook_url, message)

Expand Down

0 comments on commit 74f8d19

Please # to comment.