Open Skyfay opened 1 year ago
That's because discord expects message text under "content" property, while cronicle uses "text" property (would work with slack and many other messengers). e.g.
curl -H "Content-Type: application/json" -d '{"content": "hello"}' $WEBHOOK_URL
I don't think you can configure that, although you may do a little tweak in lib/job.js file
locate this line:
https://github.com/jhuckaby/Cronicle/blob/a093f6b94dba3bb6017b3f9e621ddecf84892973/lib/job.js#L1404
then on the next line add something like hook_data.content = hook_data.text
Thank you, that works for now. I'll see if I can make it a bit more beautiful with embeds, but that's already great. Is there a reason why webhooks don't have two, one for success and one for failure?
Thank you for that, @mikeTWC1984. If I add that line into the base code, would it break Slack or others? Hmmm... maybe it should be a configurable property name instead.
In Cronicle v2, the web hooks are much more configurable, including assigning them as actions to job complete, job failure, other error codes, etc.
Adding content
as a copy of text
seems to work on both Discord and Slack, in my testing. I'll go ahead and commit that right now.
Hey @jhuckaby
@Skyfay See Wiki here: https://github.com/jhuckaby/Cronicle/wiki/Discord-Webhook-Integration
I believe it answers both of your questions.
@jhuckaby Thanks. So, embeds work like this:
{
"embeds": [{
"title": "Hello!",
"description": "Hi! :grinning:"
}]
}
How could I now integrate this into the config, can you give me an example? And is it possible to configure that the different templates (start, complet, failure) can be sent (Global) to different webhook URL's?
I'm sorry, there's no way to do that with Cronicle. You can only customize the text for the notification.
Apologies, but there's also no way to customize the webhook URLs per outcome. However, this feature will be coming in Cronicle v2 (will release sometime in 2023).
Summary
I am trying to send a report to Discord via Webhoock after a job. However, it does not work. Is that even possible?
Steps to reproduce the problem
I created a Webhook link in Discord and then entered it in the software under "Web Hook" under "E-mail".