Hello,
at first, I am very happy to found this "webhook server" here. its working very well for some tests, BUT
the main reason for searching a "webhook server" was that I would send webhooks from my plex media server to webhook server localy.
It looks like the paypload coming from plex media server is malformed, for every hook there are something like this:
[webhook] 2019/04/02 14:33:36 [f022a4] error parsing form payload invalid URL escape "%4\x92"
But a 2nd webhook-entry in the plex media server configuration to webhook.site (Testing Website) looks good, there the payload received successfully.
Has someone maybe also a plex media server and can test this issue?
edit: here is the payload:
{"event":"media.play","user":true,"owner":true,"Account":{"id":1,"thumb":"https://plex.tv/users/35a30735d350ab11/avatar?c=34253252","title":"plex@myserver"},"Server":{"title":"PLEXSERVER","uuid":"0c242342473962532jilk23432432523522"},"Player":{"local":true,"publicAddress":"55.26.29.89","title":"Firefox","uuid":"z9yrpwerwrwerrwtkb808ev"},"Metadata":{"librarySectionType":"show","ratingKey":"57828","key":"/library/metadata/57838","parentRatingKey":"53825","grandparentRatingKey":"27834","guid":"com.plexapp.agents.thetvdb://315122/1/3?lang=de","librarySectionTitle":"Serien","librarySectionID":21,"librarySectionKey":"/library/sections/21","type":"episode","title":"The Ex-Best Friend","titleSort":"TitleXXXX","grandparentKey":"/library/metadata/57224","parentKey":"/library/metadata/57825","grandparentTitle":"SeriennameXXX","parentTitle":"Season 1","contentRating":"Not Rated","summary":"Plot der Serie XXX. ","index":3,"parentIndex":1,"viewOffset":199000,"lastViewedAt":1554210778,"year":2015,"thumb":"/library/metadata/57828/thumb/1554121566","art":"/library/metadata/57824/art/1554121566","parentThumb":"/library/metadata/57825/thumb/1554121566","grandparentThumb":"/library/metadata/57824/thumb/1554121566","grandparentArt":"/library/metadata/57824/art/1554121566","originallyAvailableAt":"2015-10-21","addedAt":1552565597,"updatedAt":1554121566}}
Best regards
Hi, could you try adding "incoming-payload-content-type": "application/json" to your hook definition, and see if that works for you?
Hi adnanh,
thx for you answer, but still no success :
with:
"incoming-payload-content-type": "application/json"
the error is:
C:\Users\anon\Downloads\webhook-windows-amd64.tar\webhook-windows-amd64>webhook.exe -hooks plex.json -verbose
[webhook] 2019/04/02 17:31:13 version 2.6.9 starting
[webhook] 2019/04/02 17:31:13 attempting to load hooks from plex.json
[webhook] 2019/04/02 17:31:13 found 1 hook(s) in file
[webhook] 2019/04/02 17:31:13 loaded: plex-webhook
[webhook] 2019/04/02 17:31:13 serving hooks on http://0.0.0.0:9000/hooks/{id}
[webhook] 2019/04/02 17:31:17 [272178] incoming HTTP request from 192.168.20.10:40754
[webhook] 2019/04/02 17:31:17 [272178] plex-webhook got matched
[webhook] 2019/04/02 17:31:17 [272178] error parsing JSON payload invalid character '-' in numeric literal
[webhook] 2019/04/02 17:31:17 [272178] plex-webhook hook triggered successfully
[webhook] 2019/04/02 17:31:17 200 | 19.0019ms | 192.168.20.10:9000 | POST /hooks/plex-webhook
[webhook] 2019/04/02 17:31:17 [272178] error extracting command arguments: couldn't retrieve argument for {Source:payload Name:event EnvName: Base64Decode:false}
[webhook] 2019/04/02 17:31:17 [272178] executing C:/Users/anon/Downloads/webhook-windows-amd64.tar/webhook-windows-amd64/test.cmd (C:/Users/anon/Downloads/webhook-windows-amd64.tar/webhook-windows-amd64/test.cmd) with arguments ["C:/Users/anon/Downloads/webhook-windows-amd64.tar/webhook-win
dows-amd64/test.cmd" ""] and environment [] using C:/Users/anon/Downloads/webhook-windows-amd64.tar/webhook-windows-amd64/ as cwd
[webhook] 2019/04/02 17:31:17 [272178] command output:
C:\Users\anon\Downloads\webhook-windows-amd64.tar\webhook-windows-amd64>echo "" 1>C:\Users\anon\Downloads\webhook-windows-amd64.tar\webhook-windows-amd64\Payload.log
so with "application/json" force the error moved from:
invalid URL escape "%4\x92"
to
invalid character '-' in numeric literal
Additional info: Iam using Windows Server 2008 R2
Another hints to solve this issue?
Best regards
Can you share your hooks config?
sure, its very empty, Iam new to it:
[
{
"id": "plex-webhook",
"incoming-payload-content-type": "application/json",
"execute-command": "C:/Users/anon/Downloads/webhook-windows-amd64.tar/webhook-windows-amd64/test.cmd",
"command-working-directory": "C:/Users/anon/Downloads/webhook-windows-amd64.tar/webhook-windows-amd64/",
"pass-arguments-to-command":
[
{
"source": "payload",
"name": "event"
}
],
"trigger-rule":
{
"match":
{
"type": "ip-whitelist",
"ip-range": "192.168.20.0/24"
}
}
}
]
From the PLEX docs, this is what could be causing the issue:
As stated above, the payload is sent in JSON format inside a multipart HTTP POST request. For the media.play and media.rate events, a second part of the POST request contains a JPEG thumbnail for the media.
It's a multipart payload, and the second part is an image...
Ohhhh shit ;(, so it‘s not possible to handle it correctly?
are there a way to split the first and second payload „raw“ and save to seperate files? so I can process it with cmd/powershell?
Or is there a better way?
best regards
We're seen this before in #182. Webhook doesn't currently handle multipart messages.
hi moorereason,
arghhhhhh :-( is there a hope that it is supported in future releases?
can this code help: https://github.com/XanderStrike/plexhooks (Go)
would be sooooo great.
best regards
For now #360 should make it a bit more clear in logs what's really going on. And #356 should provide a temporary workaround mechanism. But the real implementation is proper multipart form handling.
Hi guys, when we can expect 2.7.0 to be released, I'd really appreciate this feature as well?
Thanks and keep up the good work!
FYI I have created GitLab snippet about how to send Telegram notifications if certain Plex events occur and all that by using this extraordinary service :slightly_smiling_face:.
I've built the code from development branch which already has that feature (multipart HTTP request support) merged and it's working like a charm so far.
Cheers guys!
@psyhomb 2.7.0 is out :)
Merged into master as f38dfbb.
@psyhomb 2.7.0 is out :)
Awsome news, thanks guys!