Giter Club home page Giter Club logo

Comments (14)

seanvree avatar seanvree commented on August 25, 2024 1

@caronc IT WORKED!

c:\Program Files\SABnzbd\scripts>git pull
Already up-to-date.

c:\Program Files\SABnzbd\scripts>python notify.py -b "test" -s mmosts://domain.com/wireapm5w7gfmek1jkr6zm0000?verify=False -D
[INFO] [DEBUG] Script mode forced off.
2017-07-05 17:58:52,582 - 41176 - DEBUG - get(default) SERVERS=None
2017-07-05 17:58:52,582 - 41176 - DEBUG - set(config) SERVERS="mmosts://domain.com/wireapm5w7gfmek1jkr6zmq0000?verify=False"
2017-07-05 17:58:52,582 - 41176 - DEBUG - set(environment) SERVERS="mmosts://domain.com/wireapm5w7gfmek1jkr6zm0000?verify=False"
2017-07-05 17:58:52,582 - 41176 - DEBUG - get(default) TITLE=None
2017-07-05 17:58:52,582 - 41176 - DEBUG - get(default) BODY=None
2017-07-05 17:58:52,582 - 41176 - DEBUG - set(config) BODY="test"
2017-07-05 17:58:52,582 - 41176 - DEBUG - set(environment) BODY="test"
2017-07-05 17:58:52,582 - 41176 - DEBUG - get(default) INCLUDEIMAGE=None
2017-07-05 17:58:52,582 - 41176 - DEBUG - get(config) SERVERS="mmosts://mydomain.com/wireapm5w7gfmek1jkr6zm0000?verify=False"
2017-07-05 17:58:52,582 - 41176 - DEBUG - get(config) SERVERS="mmosts://mydomain.com/wireapm5w7gfmek1jkr6zmq0000?verify=False"
2017-07-05 17:58:52,584 - 41176 - DEBUG - get(default) TITLE="Test Notify Title"
2017-07-05 17:58:52,584 - 41176 - DEBUG - get(config) BODY="test"
2017-07-05 17:58:52,585 - 41176 - DEBUG - get(default) INCLUDEIMAGE=None
2017-07-05 17:58:52,585 - 41176 - DEBUG - get(default) INCLUDEIMAGE=None
2017-07-05 17:58:52,585 - 41176 - DEBUG - get(config) SERVERS="mmosts://mydomain.com/wireapm5w7gfmek1jkr6zmqfww?verify=False"
2017-07-05 17:58:52,585 - 41176 - DEBUG - Server parsed to: {'host': 'mydomain.com', 'user': None, 'query': 'wireapm5w7gfmek1jkr6zmqfww', 'url': 'mmosts://domain.com/wireapm5w7gfmek1jkr6zm0000', 'path': '/', 'fullpath': '/wireapm5w7gfmek1jkr6zmqfww', 'password': None, 'port': None, 'qsd': {'verify': 'False'}, 'schema': 'mmosts'}
2017-07-05 17:58:52,611 - 41176 - DEBUG - MatterMost POST URL: https://domain.com:8065/hooks/wireapm5w7gfmek1jkr6zm000 (cert_verify=False)
2017-07-05 17:58:52,611 - 41176 - DEBUG - MatterMost Payload: {'text': 'test', 'icon_url': 'http://nzbget.lead2gold.org/notify/nzbget-notify-info-72x72.png'}
2017-07-05 17:58:52,648 - 41176 - INFO - Sent MatterMost notification.
2017-07-05 17:58:52,650 - 41176 - DEBUG - Exiting with return code: 93

c:\Program Files\SABnzbd\scripts>

from nzb-notify.

caronc avatar caronc commented on August 25, 2024

I personally never used MattersMost; thanks for sharing it!

When i get home I'll have a look at their API documentation and see how it works. If it's anything like every other API out there (including Slack's) it shouldn't be too hard to implement.

Perhaps this Notify tool could be updated to support a URL such as: mmost://hostname:port/key/ ?

That would get substituted for a URL like you suggested (https://hostname:port/hooks/key)?
We could make the default port be 8065, so you could also just write the url as: mmost://hostname/key/? Sound good?

So in your case (with respect to your ticket), you'd use the URL mmost://hooks.domain.com/wireaom5w7gfmek1jkr6znqfww/ which would do the translation for you.

Anyway, I will keep you posted (as i learn more) and poke at it's implementation as the week goes by. If you have any info to share to speed the process along; it will always be welcome.

from nzb-notify.

caronc avatar caronc commented on August 25, 2024

Linking ticket to sabnzbd/sabnzbd#435

from nzb-notify.

seanvree avatar seanvree commented on August 25, 2024

@caronc ,

Yeah, it should be no problem with an incoming webook. Are you familiar with Sonarr or Radarr, they both have it, pretty simple code.

Yes, the format is exactly how you mentioned:

https://mydomain.com:8065/hooks/g3mjakha57gsxyob8a3jmn1wxo

(Obviously, the hostname is the server which is running Mattermost)

So, as long as I have local DNS setup, I don't even need to be connected to the WAN...This script would send the notification to the MM server via hostname (mydomain.com)

But yeah, not sure how to edit the config file to work without the 3 tokens.

Anyway, let me know if you get anywhere with this!!

THANKS!

from nzb-notify.

caronc avatar caronc commented on August 25, 2024

If you wouldn't mind; could you please check out the master branch and giver a whirl?

Since the API works via a secure method too (https), you can use mmost:// for insecure (http://) and mmosts:// for secure. In both cases, the default port is 8065 so it is not necessary to specify it as part of the URL. Does this seem reasonable?

Please let me know your results. With respect to your last post, the following should work from the command line:

python Notify.py -b body -s mmosts://mydomain.com/g3mjakha57gsxyob8a3jmn1wxo

At the moment, i don't use/support the --title (-t) switch. Well... specifying it just doesn't do anything with it (yet). I was thinking about placing the title on the first line of the body, and then appending the body after that. Would that make sense? The API message doesn't support a title or heading type entry; just a body.

from nzb-notify.

seanvree avatar seanvree commented on August 25, 2024

@caronc - THANKS!

WIll do in a bit and report back!

from nzb-notify.

seanvree avatar seanvree commented on August 25, 2024

@caronc -

OKay, I think we are ALMOST there

So, my install of MM is on TLS port 8065.

so here is the output when I send:
(FYI, I've changed the host and the hook info on here for security:

C:\Program Files\SABnzbd\scripts>python notify.py -b "test" -s mmosts://mydomain.com/wireapm5w7gfmek1jkr6zmq000 -D
[INFO] [DEBUG] Script mode forced off.
2017-07-05 01:25:13,871 - 29288 - DEBUG - get(default) SERVERS=None
2017-07-05 01:25:13,871 - 29288 - DEBUG - set(config) SERVERS="mmosts://mydomain.com/wireapm5w7gfmek1jkr6zmq000"
2017-07-05 01:25:13,871 - 29288 - DEBUG - set(environment) SERVERS="mmosts://mydomain.com/wireapm5w7gfmek1jkr6zmqf000"
2017-07-05 01:25:13,871 - 29288 - DEBUG - get(default) TITLE=None
2017-07-05 01:25:13,871 - 29288 - DEBUG - get(default) BODY=None
2017-07-05 01:25:13,871 - 29288 - DEBUG - set(config) BODY="test"
2017-07-05 01:25:13,871 - 29288 - DEBUG - set(environment) BODY="test"
2017-07-05 01:25:13,871 - 29288 - DEBUG - get(default) INCLUDEIMAGE=None
2017-07-05 01:25:13,871 - 29288 - DEBUG - get(config) SERVERS="mmosts://mydomain.com/wireapm5w7gfmek1jkr6zmqf000"
2017-07-05 01:25:13,871 - 29288 - DEBUG - get(config) SERVERS="mmosts://mydomain.com/wireapm5w7gfmek1jkr6zmqf000"
2017-07-05 01:25:13,871 - 29288 - DEBUG - get(default) TITLE="Test Notify Title"
2017-07-05 01:25:13,871 - 29288 - DEBUG - get(config) BODY="test"
2017-07-05 01:25:13,872 - 29288 - DEBUG - get(default) INCLUDEIMAGE=None
2017-07-05 01:25:13,872 - 29288 - DEBUG - get(default) INCLUDEIMAGE=None
2017-07-05 01:25:13,872 - 29288 - DEBUG - get(config) SERVERS="mmosts://mydomain.com/wireapm5w7gfmek1jkr6zmqf000"
2017-07-05 01:25:13,874 - 29288 - DEBUG - Server parsed to: {'host': 'mydomain.com', 'user': None, 'query': 'wireapm5w7gfmek1jkr6zmqfww', 'url': '"mmosts://mydomain.com/wireapm5w7gfmek1jkr6zmqf000"', 'path': '/', 'fullpath': '/wireapm5w7gfmek1jkr6zmqfww', 'password': None, 'port': None, 'qsd': {}, 'schema': 'mmosts'}
2017-07-05 01:25:13,881 - 29288 - DEBUG - MatterMost POST URL: "mmosts://mydomain.com/wireapm5w7gfmek1jkr6zmqf000"
2017-07-05 01:25:13,881 - 29288 - DEBUG - MatterMost Payload: {'payload': {'text': 'test', 'icon_url': 'http://nzbget.lead2gold.org/notify/nzbget-notify-info-72x72.png'}}
2017-07-05 01:25:13,914 - 29288 - WARNING - A Connection error occured sending MatterMost notification.
2017-07-05 01:25:13,914 - 29288 - DEBUG - Socket Exception: ("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",)
2017-07-05 01:25:13,915 - 29288 - DEBUG - Exiting with return code: 93

C:\Program Files\SABnzbd\scripts>

NOW, if I send via non-TLS:

C:\Program Files\SABnzbd\scripts>python notify.py -b "test" -s mmost://mydomain.com/wireapm5w7gfmek1jkr6zmq000 -D
[INFO] [DEBUG] Script mode forced off.
2017-07-05 01:25:54,575 - 25676 - DEBUG - get(default) SERVERS=None
2017-07-05 01:25:54,575 - 25676 - DEBUG - set(config) SERVERS="mmost://mydomain.com/wireapm5w7gfmek1jkr6zmqf000"
2017-07-05 01:25:54,575 - 25676 - DEBUG - set(environment) SERVERS="mmost://mydomain.com/wireapm5w7gfmek1jkr6zmqf000"
2017-07-05 01:25:54,575 - 25676 - DEBUG - get(default) TITLE=None
2017-07-05 01:25:54,575 - 25676 - DEBUG - get(default) BODY=None
2017-07-05 01:25:54,575 - 25676 - DEBUG - set(config) BODY="test"
2017-07-05 01:25:54,575 - 25676 - DEBUG - set(environment) BODY="test"
2017-07-05 01:25:54,575 - 25676 - DEBUG - get(default) INCLUDEIMAGE=None
2017-07-05 01:25:54,575 - 25676 - DEBUG - get(config) SERVERS="mmost://mydomain.com/wireapm5w7gfmek1jkr6zmq000"
2017-07-05 01:25:54,576 - 25676 - DEBUG - get(config) SERVERS="mmost://mydomain.com/wireapm5w7gfmek1jkr6zmq000"
2017-07-05 01:25:54,578 - 25676 - DEBUG - get(default) TITLE="Test Notify Title"
2017-07-05 01:25:54,578 - 25676 - DEBUG - get(config) BODY="test"
2017-07-05 01:25:54,578 - 25676 - DEBUG - get(default) INCLUDEIMAGE=None
2017-07-05 01:25:54,578 - 25676 - DEBUG - get(default) INCLUDEIMAGE=None
2017-07-05 01:25:54,578 - 25676 - DEBUG - get(config) SERVERS="mmost://mydomain.com/wireapm5w7gfmek1jkr6zmq000"
2017-07-05 01:25:54,579 - 25676 - DEBUG - Server parsed to: {'host': 'mydomain.com', 'user': None, 'query': 'wireapm5w7gfmek1jkr6zmqfww', 'url': '"mmost://mydomain.com/wireapm5w7gfmek1jkr6zmq000"', 'path': '/', 'fullpath': '/wireapm5w7gfmek1jkr6zmqfww', 'password': None, 'port': None, 'qsd': {}, 'schema': 'mmost'}
2017-07-05 01:25:54,594 - 25676 - DEBUG - MatterMost POST URL: "mmost://mydomain.com/wireapm5w7gfmek1jkr6zmq000"
2017-07-05 01:25:54,594 - 25676 - DEBUG - MatterMost Payload: {'payload': {'text': 'test', 'icon_url': 'http://nzbget.lead2gold.org/notify/nzbget-notify-info-72x72.png'}}
2017-07-05 01:25:54,624 - 25676 - INFO - Sent MatterMost notification.
2017-07-05 01:25:54,624 - 25676 - DEBUG - Exiting with return code: 93

C:\Program Files\SABnzbd\scripts>

SO, it with TLS, it says bad socket...not sure why that would be, certs are good, and I have a couple other applications sending via TLS that work fine (sonarr, radarr, Plexpy)

but, it says notification sent on non-TSL? But the notification never arrives.

Any ideas?

from nzb-notify.

caronc avatar caronc commented on August 25, 2024

I accidentally closed this issue with previous commit that was not meant to go against this ticket (meant for #20 instead). Sorry about that.

That said, #20 is applicable to your situation. You'll need to check out the master branch again.

Then try adding a ?verify=No at the end of your URL when using the mmosts:// (secure) method. This should fix your SSL error you were getting.

I adjusted the payload (submitted to your server) which may solve the 'why nothing is happening' issue. This part is a bit confusing to me though because the payload appears correct already according to the documentation. However the documentation also states that this changed method is valid as well.

On a side note:
The only confusing thing about your last post was this line:

2017-07-05 01:25:54,594 - 25676 - DEBUG - MatterMost POST URL: "mmost://mydomain.com/wireapm5w7gfmek1jkr6zmq000"

Did it really say that? Or did you just mask some values for obvious reasons? The part that has me confused is that that URL should have read the following (for secure):

https://mydomain.com:8065/hooks/wireapm5w7gfmek1jkr6zmqf000

Your logs don't show the /hooks, the port, or the https:// which has me concerned.

from nzb-notify.

seanvree avatar seanvree commented on August 25, 2024

FYI: Yes, I did change the hook info to mask the data.

sabnzbdnotify

from nzb-notify.

seanvree avatar seanvree commented on August 25, 2024

@caronc -

Hey buddy! Thanks so much for this. The ONLY issue I"m having is that the BOT nick says webhook any way to change that?

from nzb-notify.

caronc avatar caronc commented on August 25, 2024

Try mmost://newbotname@hostname/key and let me know! :)

from nzb-notify.

seanvree avatar seanvree commented on August 25, 2024

@caronc - Nope:

using : mmosts://[email protected]/wireapm5w7gfmek1jkr6zm0000?verify=False

 Notification script returned exit code 1 and output "2017-07-06 17:01:22,434 - 36664 - ERROR - Fatal Exception:
 Traceback (most recent call last):
 File "C:\Program Files\SABnzbd\scripts\Notify\nzbget\ScriptBase.py", line 2873, in run
 exit_code = main_function(*args, **kwargs)
 File "C:\Program Files\SABnzbd\scripts\Notify.py", line 1172, in main
 notify_type=notify_type,
 File "C:\Program Files\SABnzbd\scripts\Notify.py", line 964, in notify
 nobj.notify(body=body, title=title, notify_type=notify_type)
 File "C:\Program Files\SABnzbd\scripts\Notify\pnotify\NotifyBase.py", line 444, in notify
 **kwargs):
 File "C:\Program Files\SABnzbd\scripts\Notify\pnotify\NotifyMatterMost.py", line 110, in _notify
 payload['payload']['username'] = self.user
 KeyError: 'payload'
 
 "

from nzb-notify.

caronc avatar caronc commented on August 25, 2024

Please check out the master and try again. Please keep me posted. Sorry about that and thanks for all of your patients and testing!

from nzb-notify.

seanvree avatar seanvree commented on August 25, 2024

@caronc - WORKED!

you're the man!

from nzb-notify.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.