Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflict with the "method" parameter in Custom Form #908

Closed
hhhguany opened this issue Jul 18, 2023 · 11 comments
Closed

Conflict with the "method" parameter in Custom Form #908

hhhguany opened this issue Jul 18, 2023 · 11 comments

Comments

@hhhguany
Copy link

hhhguany commented Jul 18, 2023

Question

I am facing an issue regarding the integration of Synology Chat's webhook with Custom Form. The webhook URL I am using is https://[hostname]:[port]/webapi/entry.cgi?api=SYNO.Chat.External&method=incoming&version=2&token=xxx.

As per the documentation, I need to use GET parameters in the POST method. Therefore, I have written the URL in Apprise as follows:

forms://[hostname]:[port]/webapi/entry.cgi?-api=SYNO.Chat.External&-method=incoming&-version=2&-token=xxx

However, it seems that the method parameter is conflicting with the default method, and the message is not being sent properly. Could you please provide guidance on how to resolve this issue?

@caronc
Copy link
Owner

caronc commented Jul 19, 2023

Apprise uses the method internally, I'll need to think/investigate this. It may be a bug, I'm not sure at this point

@caronc
Copy link
Owner

caronc commented Jul 22, 2023

Is Synology Chatting pretty straight forward? Another option is to just create a synology:// Apprise URL

@caronc
Copy link
Owner

caronc commented Aug 7, 2023

I can't seem to reproduce the issue you're having. the URL you're providing works great. But it's setting the following HTTP Headers. Is this what you want? Or is the the payload you want to change?

You're setting http:// parameters by specifying the -, is this what you want? Is the the payload you wish to change instead? You're effectively creating this post request:

curl "https://[hostname]:[port]/webapi/entry.cgi?api=SYNO.Chat.External&method=incoming&version=2&token=xxx"

# With Payload:
message=message
title=title
version=1.0
type=info

Is this what you're attempting to achieve?

@caronc
Copy link
Owner

caronc commented Aug 19, 2023

Any update to to this?

@hhhguany
Copy link
Author

hhhguany commented Aug 30, 2023

Apologies for the delayed response...

I'm still having trouble in integrating Apprise with Synology Chat. According to the Synology documentation, there are two methods to send data to the webhook URL:

  • A JSON string as the payload parameter in a POST request.
  • A JSON string as the body of a POST request.

I've attempted both the jsons:// and form:// methods, but I'm unable to trigger the webhook correctly, and it seems to be related to the payload format. Synology Chat requires the JSON payload to include a text field, which I'm unsure how to properly incorporate for it to work.

The URL in Apprise I tried:

jsons://[hostname]:[port]/webapi/entry.cgi?-api=SYNO.Chat.External&-method=incoming&-version=2&-token=xxx&:text='test'
forms://[hostname]:[port]/webapi/entry.cgi?-api=SYNO.Chat.External&-method=incoming&-version=2&-token=xxx&:text='test'

How can I correctly structure the payload to ensure the text field is included and the webhook is triggered successfully in Synology Chat?

I appreciate any assistance or guidance on this matter.

@caronc caronc mentioned this issue Sep 9, 2023
8 tasks
@caronc
Copy link
Owner

caronc commented Sep 9, 2023

I think i've uncovered a bug and while the URL should work for you, (it does in form://, you need json:// based on what you shared with me (and the API).

The json:// is supposed to work the same way but it's broken; i fixed this with #920, but more importantly, i made your life easier by adding synology:// and synologys:// (for https) Messages.

I would love for you to follow the instructions on #944 and test it out for me; i think it would make a fine addition to the Apprise library! 🚀

@caronc caronc mentioned this issue Sep 9, 2023
4 tasks
@caronc
Copy link
Owner

caronc commented Oct 8, 2023

@hhhguany : Having not heard back, i'm tempted to close this ticket, but i thought i'd reach out one last time to see if you could help test out #944 which built for you. I think it would make your life easier with integrated Synology Chat support, not to mention it's a great addition to Apprise.

I'll hold off until i confirm it works before merging though (this is where i need your help). I hope to hear back! 🚀 🙏

@caronc
Copy link
Owner

caronc commented Oct 15, 2023

Closing this ticket off due to lack of response. Please feel free to reach out anytime if you want to resume this! 🙏

@caronc caronc closed this as completed Oct 15, 2023
@hhhguany
Copy link
Author

Hi,

I have conducted tests on my own Synology NAS and successfully sent them out via apprise. However, no messages were received on Synology Chat. Here are the verbose logs generated by apprise:

apprise -t "Test Title" -b "Test Message" "synologys://nas.domain:8888/token” -vvvv
2023-11-14 18:05:47,624 - DEBUG - Could not load translation path: /home/user/apprise/lib/python3.10/site-packages/apprise/i18n/en
2023-11-14 18:05:47,627 - TRACE - Synology Chat URL synologys://nas.domain:8888/token unpacked as:
user="None"
password="None"
port=“8888”
host="nas.domain"
fullpath=""
path="/"
query="token"
schema="synologys"
url="synologys://nas.domain:8888/token"
qsd="{}"
qsd+="{}"
qsd-="{}"
qsd:="{}"
secure="True"
verify="True"
headers="{}"
token="token"
2023-11-14 18:05:47,627 - DEBUG - Loaded Synology Chat URL: synologys://nas.domain:8888/x...x/?format=text&overflow=upstream&rto=4.0&cto=4.0&verify=yes
2023-11-14 18:05:47,627 - DEBUG - Synology Chat POST URL: https://nas.domain:8888/webapi/entry.cgi (cert_verify=True)
2023-11-14 18:05:47,627 - DEBUG - Synology Chat Payload: {'text': 'Test Title\r\nTest Message'}
2023-11-14 18:05:47,758 - INFO - Sent Synology Chat notification.

Since Synology Chat does not provide any interface, I’m currently unable to ascertain the root cause of the issue. However, I can confirm that there is no issue with the network link between my test machine and Synology Chat.

Thank you for your work. If you currently don’t have Synology Chat, please inform me when the next version is released, and I would be more than willing to assist you in testing it.

@caronc caronc reopened this Nov 16, 2023
@hhhguany
Copy link
Author

Here are some projects that can be referenced.

@caronc
Copy link
Owner

caronc commented Nov 19, 2023

Merged into the master branch! Closing issue as done. Thank your for all of your help @hhhguany 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants