BillOatman 492 Posted March 18, 2021 Share Posted March 18, 2021 (edited) Hi, I've been looking at the wiki and forum for information on how to implement a webhook endpoint. Primarily what information is actually sent, and how (get/post/put) it is sent to the endpoint. Is there information somewhere on this? Thanks! Edited March 18, 2021 by BillOatman Link to comment Share on other sites More sharing options...
rechigo 293 Posted March 18, 2021 Share Posted March 18, 2021 You could use a dummy webhook to see what parameters Emby sends using a site such as https://webhook.site/ Once you've got a dummy webhook from the site, you can simply add a new webhook in the Emby webhooks plugin, enable all the events, and for each event do an action that would result in that event being emitted (i.e. playing a video) 1 Link to comment Share on other sites More sharing options...
Luke 36887 Posted March 19, 2021 Share Posted March 19, 2021 6 hours ago, rechigo said: You could use a dummy webhook to see what parameters Emby sends using a site such as https://webhook.site/ Once you've got a dummy webhook from the site, you can simply add a new webhook in the Emby webhooks plugin, enable all the events, and for each event do an action that would result in that event being emitted (i.e. playing a video) That's a great tip, thanks. I've been meaning to update the web hooks config pages to show the contents of a sample payload. Link to comment Share on other sites More sharing options...
BillOatman 492 Posted March 19, 2021 Author Share Posted March 19, 2021 Thanks guys. I configured a webhook in Emby last night but when sending the test message it got an error about a invalid URL. I have the info from the log at home and will post later. But all I had for the url was http://localhost:12345/api/test I also tried with the IP address of the Emby server instead of localhost and got the same error. How is the url supposed to be specified? Link to comment Share on other sites More sharing options...
Luke 36887 Posted March 19, 2021 Share Posted March 19, 2021 You'd have to look at the log. The url might be fine, but maybe the server got an error response back, or couldn't connect at all to it. Link to comment Share on other sites More sharing options...
BillOatman 492 Posted March 20, 2021 Author Share Posted March 20, 2021 (edited) @Luke Here is the data from the log. The top one is when I used localhost and the bottom when I used the IP address. The endpoint is on the same box as the Emby server. 2021-03-18 18:29:55.975 Info HttpClient: POST http://localhost:12345/api/blah 2021-03-18 18:29:55.979 Error HttpClient: {"Message":"The request entity's media type 'multipart/form-data' is not supported for this resource.","ExceptionMessage":"No MediaTypeFormatter is available to read an object of type 'String' from content with media type 'multipart/form-data'.","ExceptionType":"System.Net.Http.UnsupportedMediaTypeException","StackTrace":" at System.Net.Http.HttpContentExtensions.ReadAsAsync[T](HttpContent content, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger, CancellationToken cancellationToken)\r\n at System.Web.Http.ModelBinding.FormatterParameterBinding.ReadContentAsync(HttpRequestMessage request, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger, CancellationToken cancellationToken)"} 2021-03-18 18:29:56.043 Error Server: Error processing request *** Error Report *** Version: 4.5.4.0 Command line: C:\Users\woatm\AppData\Roaming\Emby-Server\system\EmbyServer.dll -noautorunwebapp Operating system: Microsoft Windows 10.0.19042 Framework: .NET Core 3.1.9 OS/Process: x64/x64 Runtime: C:/Users/woatm/AppData/Roaming/Emby-Server/system/System.Private.CoreLib.dll Processor count: 12 Data path: C:\Users\woatm\AppData\Roaming\Emby-Server\programdata Application path: C:\Users\woatm\AppData\Roaming\Emby-Server\system MediaBrowser.Model.Net.HttpException: MediaBrowser.Model.Net.HttpException: {"Message":"The request entity's media type 'multipart/form-data' is not supported for this resource.","ExceptionMessage":"No MediaTypeFormatter is available to read an object of type 'String' from content with media type 'multipart/form-data'.","ExceptionType":"System.Net.Http.UnsupportedMediaTypeException","StackTrace":" at System.Net.Http.HttpContentExtensions.ReadAsAsync[T](HttpContent content, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger, CancellationToken cancellationToken)\r\n at System.Web.Http.ModelBinding.FormatterParameterBinding.ReadContentAsync(HttpRequestMessage request, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger, CancellationToken cancellationToken)"} at Emby.Server.Implementations.HttpClientManager.CoreHttpClientManager.SendAsyncInternal(HttpRequestOptions options, String httpMethod) at Emby.Server.Implementations.HttpClientManager.CoreHttpClientManager.SendAsync(HttpRequestOptions options, String httpMethod) at Emby.Server.Implementations.Services.ServiceController.GetTaskResult(Task task) at Emby.Server.Implementations.Services.ServiceHandler.ProcessRequestAsync(HttpListenerHost appHost, IRequest httpReq, IResponse httpRes, RestPath restPath, String responseContentType, CancellationToken cancellationToken) at Emby.Server.Implementations.HttpServer.HttpListenerHost.RequestHandler(IRequest httpReq, ReadOnlyMemory`1 urlString, ReadOnlyMemory`1 localPath, CancellationToken cancellationToken) Source: Emby.Server.Implementations TargetSite: Void MoveNext() ________________________ 2021-03-18 18:35:08.047 Info HttpClient: POST http://192.168.50.42:12345/api/blah 2021-03-18 18:35:08.049 Error HttpClient: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> <HTML><HEAD><TITLE>Bad Request</TITLE> <META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD> <BODY><h2>Bad Request - Invalid Hostname</h2> <hr><p>HTTP Error 400. The request hostname is invalid.</p> </BODY></HTML> 2021-03-18 18:35:08.050 Error Server: Error processing request *** Error Report *** Version: 4.5.4.0 Command line: C:\Users\woatm\AppData\Roaming\Emby-Server\system\EmbyServer.dll -noautorunwebapp Operating system: Microsoft Windows 10.0.19042 Framework: .NET Core 3.1.9 OS/Process: x64/x64 Runtime: C:/Users/woatm/AppData/Roaming/Emby-Server/system/System.Private.CoreLib.dll Processor count: 12 Data path: C:\Users\woatm\AppData\Roaming\Emby-Server\programdata Application path: C:\Users\woatm\AppData\Roaming\Emby-Server\system MediaBrowser.Model.Net.HttpException: MediaBrowser.Model.Net.HttpException: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> <HTML><HEAD><TITLE>Bad Request</TITLE> <META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD> <BODY><h2>Bad Request - Invalid Hostname</h2> <hr><p>HTTP Error 400. The request hostname is invalid.</p> </BODY></HTML> at Emby.Server.Implementations.HttpClientManager.CoreHttpClientManager.SendAsyncInternal(HttpRequestOptions options, String httpMethod) at Emby.Server.Implementations.HttpClientManager.CoreHttpClientManager.SendAsync(HttpRequestOptions options, String httpMethod) at Emby.Server.Implementations.Services.ServiceController.GetTaskResult(Task task) at Emby.Server.Implementations.Services.ServiceHandler.ProcessRequestAsync(HttpListenerHost appHost, IRequest httpReq, IResponse httpRes, RestPath restPath, String responseContentType, CancellationToken cancellationToken) at Emby.Server.Implementations.HttpServer.HttpListenerHost.RequestHandler(IRequest httpReq, ReadOnlyMemory`1 urlString, ReadOnlyMemory`1 localPath, CancellationToken cancellationToken) Source: Emby.Server.Implementations TargetSite: Void MoveNext() I'm guessing it wants the ip address and not localhost, but why it the bottom one invalid? HTTP Error 400. The request hostname is invalid. Edited March 20, 2021 by BillOatman Link to comment Share on other sites More sharing options...
Luke 36887 Posted March 21, 2021 Share Posted March 21, 2021 Whatever code is receiving the request is rejecting with a 400 response because it doesn't like the value of the host http request header...possibly due to it being empty. So I would look at that. Link to comment Share on other sites More sharing options...
BillOatman 492 Posted March 22, 2021 Author Share Posted March 22, 2021 On 3/20/2021 at 10:02 PM, Luke said: Whatever code is receiving the request is rejecting with a 400 response because it doesn't like the value of the host http request header...possibly due to it being empty. So I would look at that. Not even content-type?? Is there an example of the post payload for the test message and the playback type? I am trying to use the C# apicontroller to self host the receiver and it is a bit particular about what is sent, particularly if its json. Link to comment Share on other sites More sharing options...
Luke 36887 Posted March 22, 2021 Share Posted March 22, 2021 Quote Is there an example of the post payload for the test message and the playback type? It's something I've been meaning to add right into the config screen. Link to comment Share on other sites More sharing options...
BillOatman 492 Posted March 22, 2021 Author Share Posted March 22, 2021 (edited) Never mind I got it to accept raw text. Thanks. Edited March 22, 2021 by BillOatman Link to comment Share on other sites More sharing options...
BillOatman 492 Posted March 22, 2021 Author Share Posted March 22, 2021 For others ... this is what gets sent for the test button Content-Type: application/json; charset=utf-8 Content-Disposition: form-data; name=data {"Event":"system.webhooktest","Server":{"Name":"Emby Server","Id":"id-characters"}} 1 Link to comment Share on other sites More sharing options...
Loefamily 2 Posted March 4, 2022 Share Posted March 4, 2022 I recognize this thread is 1 year old, however, I found it in my search for more detailed information about Emby webhooks and the data it POSTs to the configured endpoint. I took some time to learn (for fun) Node.js, Express, and Mongoose to standup a simple API with the idea of simply logging all the events in MongoDB. Later I would decide what I want to do with them or any actions I wanted to process as they come in. Here are a couple things I learned. A. There are several events published by Webhooks (System, Playback, and User events) but I am hoping more are added such as: 1. Recording Events Recording Set/Canceled Recording Started/Completed/Failed DVR Post recording script result (return code) 2. Guide Events Guide data refreshed Series recordings - new occurrence found/scheduled B. Node Express prefers JSON out of the box Emby POSTs as mentioned by @BillOatman. The key implication is that typical route processing in Node Express won't pick up the form-data as part of req.body (request body). This means you have to tweak a few things, namely using 'multer' module. Ultimately, I ended up with: // routes/emby-event.js // Disclaimer: Clearly not production code! // let EmbyEventModel = require('../models/emby-event.model') let express = require('express') let router = express.Router() let multer = require('multer') // Required for form-data submissions let upload = multer() // CREATE a new emby-event router.post('/emby-event', upload.none(), (req, res) => { if(req.body) { console.log('Using JSON in request body') eventData = JSON.parse(req.body.data) } else { console.error('Request body not found!') res.status(400).send('Request body is missing') } // ... let model = new EmbyEventModel(eventData, false) model.save() .then(doc => { if(!doc || doc.length === 0) { console.log('error saving document') return res.status(500).send(doc) } res.status(201).send(doc) }) .catch(err => { console.error('caught an error while trying to save', err) res.status(500).json(err) }) }) C. Event Schema (relevant for Mongoose Schema and/or reference purposes): Once I was able to log the data submitted by Emby, I was able to parse it and convert the raw values to the Schema types supported by mongoose module. This is not 'strictly' required but ensures that mongoose preserves the values sent. Note: you could instead rely on an empty Schema {} with { strict : false}. Of course, I find this useful for reference as to what information is sent from Emby. Note the Schema below was sourced from raw data received for event type 'playback.start'. I haven't compared all the event types yet to know if they are consistent. // models/emby-event.model.js // Disclaimer: Clearly not production code! // let mongoose = require ('mongoose') const eventdb = { server :'localhost:27017', database : 'webhook-api', user : '***', password : '***' } conn = mongoose.createConnection(`mongodb://${eventdb.user}:${eventdb.password}@${eventdb.server}/${eventdb.database}`, { authSource: 'admin' }) let EmbyEventSchema = new mongoose.Schema( { Event: String, User: { Name: String, ServerId: String, ConnectUserName: String, ConnectLinkType: String, Id: String, PrimaryImageTag: String, HasPassword: Boolean, HasConfiguredPassword: Boolean, HasConfiguredEasyPassword: Boolean, LastLoginDate: Date, LastActivityDate: Date, Configuration: { AudioLanguagePreference: String, PlayDefaultAudioTrack: Boolean, SubtitleLanguagePreference: String, DisplayMissingEpisodes: Boolean, SubtitleMode: String, EnableLocalPassword: Boolean, OrderedViews: Array, LatestItemsExcludes: Array, MyMediaExcludes: Array, HidePlayedInLatest: Boolean, RememberAudioSelections: Boolean, RememberSubtitleSelections: Boolean, EnableNextEpisodeAutoPlay: Boolean }, Policy: { IsAdministrator: Boolean, IsHidden: Boolean, IsHiddenRemotely: Boolean, IsHiddenFromUnusedDevices: Boolean, IsDisabled: Boolean, BlockedTags: Array, IsTagBlockingModeInclusive: Boolean, EnableUserPreferenceAccess: Boolean, AccessSchedules: Array, BlockUnratedItems: Array, EnableRemoteControlOfOtherUsers: Boolean, EnableSharedDeviceControl: Boolean, EnableRemoteAccess: Boolean, EnableLiveTvManagement: Boolean, EnableLiveTvAccess: Boolean, EnableMediaPlayback: Boolean, EnableAudioPlaybackTranscoding: Boolean, EnableVideoPlaybackTranscoding: Boolean, EnablePlaybackRemuxing: Boolean, EnableContentDeletion: Boolean, EnableContentDeletionFromFolders: Array, EnableContentDownloading: Boolean, EnableSubtitleDownloading: Boolean, EnableSubtitleManagement: Boolean, EnableSyncTranscoding: Boolean, EnableMediaConversion: Boolean, EnabledChannels: Array, EnableAllChannels: Boolean, EnabledFolders: Array, EnableAllFolders: Boolean, InvalidLoginAttemptCount: Number, EnablePublicSharing: Boolean, RemoteClientBitrateLimit: Number, AuthenticationProviderId: String, ExcludedSubFolders: Array, SimultaneousStreamLimit: Number, EnabledDevices: Array, EnableAllDevices: Boolean }, PrimaryImageAspectRatio: mongoose.Decimal128 }, Item: { Name: String, ServerId: String, Id: String, DateCreated: Date, PresentationUniqueKey: String, Container: String, PremiereDate: Date, ExternalUrls: Array, Path: String, Overview: String, Taglines: Array, Genres: Array, RunTimeTicks: Number, ProductionYear: Number, ProviderIds: mongoose.Mixed, IsFolder: Boolean, ParentId: String, Type: String, Studios: Array, GenreItems: Array, SeriesName: String, SeriesId: String, SeasonId: String, PrimaryImageAspectRatio: mongoose.Decimal128, SeasonName: String, MediaStreams: [mongoose.Mixed], ImageTags: { Primary: String }, BackdropImageTags: Array, Chapters: [mongoose.Mixed], MediaType: String, Width: Number, Height: Number }, Server: { Name: String, Id: String }, Session: { RemoteEndPoint: String, Client: String, DeviceName: String, DeviceId: String, ApplicationVersion: String, Id: String } }, { strict: false }) module.exports = conn.model('Event', EmbyEventSchema) 1 Link to comment Share on other sites More sharing options...
Luke 36887 Posted March 9, 2022 Share Posted March 9, 2022 Looking at this, the User info is excessive for what webhooks is trying to accomplish. I'm going to make that smaller. If you need the full user object you can always pull it from the api. 1 Link to comment Share on other sites More sharing options...
Luke 36887 Posted March 9, 2022 Share Posted March 9, 2022 Also here's some info on new data that will be added to webhooks: 1 Link to comment Share on other sites More sharing options...
wonderwond 2 Posted August 31, 2023 Share Posted August 31, 2023 anyone use the emby webhook to work with discord server ? if so anyone have link on how to set it up ? Link to comment Share on other sites More sharing options...
Luke 36887 Posted August 31, 2023 Share Posted August 31, 2023 @roaku @BillOatman @rechigo @GrimReaper @ryzilla @Loefamily @johnnycash @adminExitium For those hoping to use WebHooks with Discord, I've pushed an update to the plugin catalog for the WebHooks plugin to allow you to configure the request content type, which you can now set to either application/json or multipart form data. This should make it a little more Discord-friendly. The update is targeting the 4.8 beta server so you'll need that to test it. Please try it out and report your experience. Thanks. 1 1 Link to comment Share on other sites More sharing options...
wonderwond 2 Posted August 31, 2023 Share Posted August 31, 2023 1 hour ago, Luke said: @roaku @BillOatman @rechigo @GrimReaper @ryzilla @Loefamily @johnnycash @adminExitium For those hoping to use WebHooks with Discord, I've pushed an update to the plugin catalog for the WebHooks plugin to allow you to configure the request content type, which you can now set to either application/json or multipart form data. This should make it a little more Discord-friendly. The update is targeting the 4.8 beta server so you'll need that to test it. Please try it out and report your experience. Thanks. thanks !!! 1 Link to comment Share on other sites More sharing options...
Stan Guiseppe 6 Posted January 4 Share Posted January 4 (edited) Hi all, I am using a Shelly brand dimmer that I can control directly via a URL from any browser on my local network eg: http://192.168.0.70/light/0?turn=on&brightness=50 Shelly calls these webhooks. When doing so in a browser, it will respond accordingly with the lights and the following is returned from the dimmer: However if I try to enter this URL in Emby Webhooks, and test the link I get this: Clearly I am missing something, I apologize in advance as I am only new to this. does there need to be another server in between Emby and the dimmer? Thank you for any guidance, and Happy New Year to all. p.s. also here is the server log: 2024-01-04 15:52:26.195 Info Server: http/1.1 Response 500 to host4. Time: 28ms. http://192.168.0.6:8096/emby/Webhooks/Send/Test?X-Emby-Client=Emby Web&X-Emby-Device-Name=Chrome Windows&X-Emby-Device-Id=ca88f39b-d5ec-424f-892c-fd49e99bdad1&X-Emby-Client-Version=4.7.14.0&X-Emby-Language=en-gb&reqformat=json 2024-01-04 15:59:52.938 Info Server: http/1.1 POST http://192.168.0.6:8096/emby/Webhooks/Send/Test?X-Emby-Client=Emby Web&X-Emby-Device-Name=Chrome Windows&X-Emby-Device-Id=451ee888-d4da-411e-876c-3fdd367d265d&X-Emby-Client-Version=4.7.14.0&X-Emby-Language=en-gb&reqformat=json. UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0 2024-01-04 15:59:52.940 Info HttpClient: POST http://192.168.0.70/light/0?turn=off 2024-01-04 15:59:52.963 Error HttpClient: Error getting response from http://192.168.0.70/light/0?turn=off *** Error Report *** Version: 4.7.14.0 Command line: /volume1/@appstore/EmbyServer/system/EmbyServer.dll -programdata /volume1/Emby -ffdetect /var/packages/EmbyServer/target/bin/ffdetect -ffmpeg /var/packages/EmbyServer/target/bin/ffmpeg -ffprobe /var/packages/EmbyServer/target/bin/ffprobe -nolocalportconfig -ignore_vaapi_enabled_flag -pidfile /volume1/Emby/EmbyServer.pid -defaultdirectory /volume1/Public -updatepackage emby-server-synology_{version}_x86_64.spk Operating system: Linux version 4.4.59+ (root@build3) (gcc version 4.9.3 20150311 (prerelease) (crosstool-NG 1.20.0) ) #25556 SMP PREEMPT Sat Aug 28 02:17:26 CST 2021 Framework: .NET 6.0.20 OS/Process: x64/x64 Runtime: volume1/@appstore/EmbyServer/system/System.Private.CoreLib.dll Processor count: 4 Data path: /volume1/Emby Application path: /volume1/@appstore/EmbyServer/system System.Net.Http.HttpRequestException: System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.IO.IOException: The response ended prematurely. at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) --- End of inner exception stack trace --- at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.DecompressionHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) at Emby.Server.Implementations.HttpClientManager.CoreHttpClientManager.SendAsyncInternal(HttpRequestOptions options, String httpMethod) Source: System.Net.Http TargetSite: Void MoveNext() InnerException: System.IO.IOException: The response ended prematurely. Source: System.Net.Http TargetSite: Void MoveNext() at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) Edited January 4 by Stan Guiseppe Link to comment Share on other sites More sharing options...
Luke 36887 Posted January 4 Share Posted January 4 9 hours ago, Stan Guiseppe said: Hi all, I am using a Shelly brand dimmer that I can control directly via a URL from any browser on my local network eg: http://192.168.0.70/light/0?turn=on&brightness=50 Shelly calls these webhooks. When doing so in a browser, it will respond accordingly with the lights and the following is returned from the dimmer: However if I try to enter this URL in Emby Webhooks, and test the link I get this: Clearly I am missing something, I apologize in advance as I am only new to this. does there need to be another server in between Emby and the dimmer? Thank you for any guidance, and Happy New Year to all. p.s. also here is the server log: 2024-01-04 15:52:26.195 Info Server: http/1.1 Response 500 to host4. Time: 28ms. http://192.168.0.6:8096/emby/Webhooks/Send/Test?X-Emby-Client=Emby Web&X-Emby-Device-Name=Chrome Windows&X-Emby-Device-Id=ca88f39b-d5ec-424f-892c-fd49e99bdad1&X-Emby-Client-Version=4.7.14.0&X-Emby-Language=en-gb&reqformat=json 2024-01-04 15:59:52.938 Info Server: http/1.1 POST http://192.168.0.6:8096/emby/Webhooks/Send/Test?X-Emby-Client=Emby Web&X-Emby-Device-Name=Chrome Windows&X-Emby-Device-Id=451ee888-d4da-411e-876c-3fdd367d265d&X-Emby-Client-Version=4.7.14.0&X-Emby-Language=en-gb&reqformat=json. UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0 2024-01-04 15:59:52.940 Info HttpClient: POST http://192.168.0.70/light/0?turn=off 2024-01-04 15:59:52.963 Error HttpClient: Error getting response from http://192.168.0.70/light/0?turn=off *** Error Report *** Version: 4.7.14.0 Command line: /volume1/@appstore/EmbyServer/system/EmbyServer.dll -programdata /volume1/Emby -ffdetect /var/packages/EmbyServer/target/bin/ffdetect -ffmpeg /var/packages/EmbyServer/target/bin/ffmpeg -ffprobe /var/packages/EmbyServer/target/bin/ffprobe -nolocalportconfig -ignore_vaapi_enabled_flag -pidfile /volume1/Emby/EmbyServer.pid -defaultdirectory /volume1/Public -updatepackage emby-server-synology_{version}_x86_64.spk Operating system: Linux version 4.4.59+ (root@build3) (gcc version 4.9.3 20150311 (prerelease) (crosstool-NG 1.20.0) ) #25556 SMP PREEMPT Sat Aug 28 02:17:26 CST 2021 Framework: .NET 6.0.20 OS/Process: x64/x64 Runtime: volume1/@appstore/EmbyServer/system/System.Private.CoreLib.dll Processor count: 4 Data path: /volume1/Emby Application path: /volume1/@appstore/EmbyServer/system System.Net.Http.HttpRequestException: System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.IO.IOException: The response ended prematurely. at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) --- End of inner exception stack trace --- at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.DecompressionHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) at Emby.Server.Implementations.HttpClientManager.CoreHttpClientManager.SendAsyncInternal(HttpRequestOptions options, String httpMethod) Source: System.Net.Http TargetSite: Void MoveNext() InnerException: System.IO.IOException: The response ended prematurely. Source: System.Net.Http TargetSite: Void MoveNext() at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) When having Emby send the request directly to Shelly, there's apparently something about the request that Shelly doesn't like. You'll need to find out what that is. One thing I can see for example is Emby will send a POST but when you test Shelly in the browser that's sending a GET. Link to comment Share on other sites More sharing options...
Stan Guiseppe 6 Posted January 5 Share Posted January 5 Ah ok thanks for the info Luke. I will try to find how to get the Shelly device to accept a POST webhook, maybe with another service in between it and Emby. Unless, I don't suppose there is any way for Emby Server to send a GET webhook? Thanks again Link to comment Share on other sites More sharing options...
Luke 36887 Posted January 5 Share Posted January 5 6 hours ago, Stan Guiseppe said: Ah ok thanks for the info Luke. I will try to find how to get the Shelly device to accept a POST webhook, maybe with another service in between it and Emby. Unless, I don't suppose there is any way for Emby Server to send a GET webhook? Thanks again There is currently no option for that. Link to comment Share on other sites More sharing options...
Stan Guiseppe 6 Posted January 6 Share Posted January 6 Ok no probs, thanks Luke. 1 Link to comment Share on other sites More sharing options...
Stan Guiseppe 6 Posted January 11 Share Posted January 11 Hi Luke, I'm still having problems getting this working. I can successfully send a POST request to a shelly switch using curl on a command line, but I am not sure how to translate this into something that emby likes? So entering this in CMD: curl -X POST -d "{"id":0, "on":true}" "http://192.168.0.80/rpc/Switch.Set" Returns this: {"was_on":true} But I am unsure how to enter this into Emby Webhooks and have it save (it is advising "Please enter a URL') Thanks for any guidance you can give, I'm slowly learning the ins and outs of how it all works Link to comment Share on other sites More sharing options...
Luke 36887 Posted January 11 Share Posted January 11 It sounds like you want to use this as the webhook url: http://192.168.0.80/rpc/Switch.Set Link to comment Share on other sites More sharing options...
Stan Guiseppe 6 Posted January 11 Share Posted January 11 So I tried: http://192.168.0.80/rpc/Switch.Set" -d "{"id":0, "on":true} Which works in curl in CMD, in Emby it fails -- but not immediately -- logs show it times out: This is on an ethernet connected device. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- *** Error Report *** Version: 4.7.14.0 Command line: /volume1/@appstore/EmbyServer/system/EmbyServer.dll -programdata /volume1/Emby -ffdetect /var/packages/EmbyServer/target/bin/ffdetect -ffmpeg /var/packages/EmbyServer/target/bin/ffmpeg -ffprobe /var/packages/EmbyServer/target/bin/ffprobe -nolocalportconfig -ignore_vaapi_enabled_flag -pidfile /volume1/Emby/EmbyServer.pid -defaultdirectory /volume1/Public -updatepackage emby-server-synology_{version}_x86_64.spk -noautorunwebapp Operating system: Linux version 4.4.59+ (root@build3) (gcc version 4.9.3 20150311 (prerelease) (crosstool-NG 1.20.0) ) #25556 SMP PREEMPT Sat Aug 28 02:17:26 CST 2021 Framework: .NET 6.0.20 OS/Process: x64/x64 Runtime: volume1/@appstore/EmbyServer/system/System.Private.CoreLib.dll Processor count: 4 Data path: /volume1/Emby Application path: /volume1/@appstore/EmbyServer/system MediaBrowser.Model.Net.HttpException: MediaBrowser.Model.Net.HttpException: Connection to http://192.168.0.80/rpc/Switch.Set" -d "{"id":0, "on":true} timed out ---> System.Threading.Tasks.TaskCanceledException: The request was canceled due to the configured HttpClient.Timeout of 20 seconds elapsing. ---> System.TimeoutException: The operation was canceled. ---> System.Threading.Tasks.TaskCanceledException: The operation was canceled. ---> System.IO.IOException: Unable to read data from the transport connection: Operation canceled. ---> System.Net.Sockets.SocketException (125): Operation canceled --- End of inner exception stack trace --- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Could it be a something in HttpClient that I need to set for the local network? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now