How To Set A Reporter For A Job?
Hello,
I am attempting to use the slack reporter. In the --edit-config file, I have set slack enabled to true and the webhook_url to the correct Slack URL. My question is now, how do I define it in the job? I don't see it described in the readthedocs documentation anywhere.
I tried something similar to the following syntax:
name: "Test 1"
url: "https://google.com/"
filter:
- html2text:
method: pyhtml2text
report:
- slack:
But that doesn't seem to work. I don't know where in the job's configuration I'm supposed to tell it to use the Slack reporter. Can someone provide me an example template of what theirs looks like?
Additionally, is it expected to receive the following error when running --test-slack:
Error while submitting message to Slack:{"message": "Cannot send an empty message", "code": 50006}
Thanks!
The reporters aren't job specific, it would send to all reporters.
Are you submitting to discord instead of slack? I think that error message is from discord.
Right now, reporters cannot be configured per-job. Closing as duplicate of #468.
Reopening and closing #468 instead.
Is there any plan on resolving this? I think this use case is really essential for this tool.
To quote from the other issue:
It can still be done by maintaining a separate config + job list and use
--configand--urlswith different invocations.
It might be essential for your use case (and you can work around it by specifying separate configs and url lists and running it for each set already now), but is not "essential for this tool". Different people use the tool differently.
For my use cases, I have a single reporter and multiple jobs, and that works just fine, and apparently this also applies to other users of this tool. I personally never had the need for setting different reporters for different jobs.
I'm sure that multiple people would welcome this change and have a use case for this, but this is not an "I'll scratch everyone's itch" project, it's an "I made this for myself, and if it's useful to anybody, that's great -- plus I'll accept pull requests if done well for things that other people might find useful and that fit the project's quality standards" project.
If you need this, feel free to implement it and send a pull request or if you don't have time or skills to implement it yourself, pay someone to do it for you.
In short, there's no plan on resolving this that I'm aware of at the moment. Patches gladly accepted.
@thp Is it possible to add a FAQ section regarding this issue to the existing documentation? It could save users some time digging through Github issues like this.
If I use different instances with their own --config and --urls, do I also need to also use a different --cache file? I am not sure if they will clash somehow.
@KuleRucket If the jobs specified within the different --urls do not overlap for different --configs then there is no possibility for clashing. A job is identified in the database by guid, a hash of the value of its job-kind specific required key (e.g. command for shell-kind jobs). See https://urlwatch.readthedocs.io/en/latest/jobs.html#jobs for more info.
If you monitor the same job with different --configs, however, I believe that through differing job-specific defaults which influence the output of a job, such as e.g. the cookies key, you can create differing job output even though the source that is monitored does not change at all. That differing output would then be reported as change.
EDIT: First answer removed.
Different guids, got it.