Skip to content

Commit

Permalink
✨ Add custom webhook as notification option (#254)
Browse files Browse the repository at this point in the history
* Add custom webhook as notification option

* Update src/helpers/notifme.ts

Co-authored-by: Anand Chowdhary <github@anandchowdhary.com>

* Update src/helpers/notifme.ts

Co-authored-by: Anand Chowdhary <github@anandchowdhary.com>

---------

Co-authored-by: Anand Chowdhary <github@anandchowdhary.com>
  • Loading branch information
coolusaHD and AnandChowdhary authored Aug 13, 2024
1 parent 73d3fa0 commit ec5aeb2
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/helpers/notifme.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import NotifmeSdk, { EmailProvider, SlackProvider, SmsProvider } from "notifme-sdk";
import axios from "axios";
import type { Channel } from "notifme-sdk";
import NotifmeSdk, { EmailProvider, SlackProvider, SmsProvider } from "notifme-sdk";
import { replaceEnvironmentVariables } from "./environment";
import { getSecret } from "./secrets";

Expand Down Expand Up @@ -391,4 +391,23 @@ export const sendNotification = async (message: string) => {
}
console.log("Finished sending Microsoft Teams");
}
if (getSecret("NOTIFICATION_CUSTOM_WEBHOOK")) {
console.log("Sending Webhook");
try {
await axios.post(`${getSecret("NOTIFICATION_CUSTOM_WEBHOOK_URL")}`,{
data: {
message: JSON.stringify(message),
}
},
{
headers: {
"Content-Type": "application/json",
},
});
console.log("Success Webhook");
} catch (error) {
console.log("Got an error", error);
}
console.log("Finished sending Webhook");
}
};

0 comments on commit ec5aeb2

Please sign in to comment.