Skip to content

Webhooks not working in production #368

Open

Description

@ric-101

Current Situation

Hi there!
So I'm trying to set up web hooks, and I managed to get things to look like they SHOULD work, but they don't when needed. Here's what I have:

  • I make my local, test environment accessible via ngrok (which provides a public https link redirected to my localhost). I configure webhooks with this URL, and it works correctly.

  • My webhook is reachable in my production environment. If I make a POST using curl or Postman or similar, to the production's webhook URL, it works.

  • but if set SwitchBot's webhook to the production's webhook URL, then it doesn't work. It seems the server never receives the POST from SwitchBot.

Things which MAY influence this:

  • my production webhook is in a https page with an invalid certificate - Still it DOES work to send it a POST (for example from here: reqbin.com)
  • my production domain name starts with a digit (ie https://47test.com) - not sure why this would be an issue, but you never know

Any ideas? what could stop SwitchBot from correctly calling my server's webhook URL?

Thank you :)

Logs

I there a way to find SwitchBot's log about webhook calls it makes? I haven't been able to find it

Configuration

Not sure what you may need, configuration works on the dev server...

Environment

Dev server: PyCharm, windows (behing ngrok)
Prod server: Linux, gunicorn, nginx, local, ssh reverse tunnel to make it accessible from outside.

Additional Context

No response

Activity

  1. Larsene commented on Nov 25, 2024

    @Larsene

    My thought is that your production server NEED a valid ssl certificate. Switchbot has no options (as far as i know) to support self signed certificates, nor to enable or disable SSL certificate checking - as Twilio allow for example).

    As you're working with a python project, you can host it online for testing, with real certificate on alwaysdata (free under 100Mb, good for testing).

    Didn't you find anything useful on nginx requests logs ?

  2. ric-101 commented on Nov 26, 2024

    @ric-101
    Author

    Thank you! Indeed seems to be working after removing SSL!

    I still can't get the webooks from he keypad though... any idea way? Also, any other event than "add/remove" code? Actually I'd like an event anytime anyone presses a key on the keypad...

    Thank you!

  3. Larsene commented on Nov 26, 2024

    @Larsene

    You're welcome.

    I've the same problem for the keypad #361 as others has #367 . There's a bug in the API for the keypad, and even after an asking on the switchbot client support, nothing change (the support doesn't help on the API).

    Anyway, the API has no webhook notifications for the key entered on the keypad, only if a code is created or deleted... A good proposal has been made here #192 but unfortunably Switchbot developpers are not really presents here....

  4. SierraPappa650 commented on Feb 21, 2025

    @SierraPappa650

    Hi

    I am having the same issue and I'm slightly confused from the above responses.

    I have setup the webhook and when I run a query against /queryWebhook with the queryDetails action, everything looks ok.

    My webhook URL is https however, my Access logs suggest that there is no attempt from Switchbot to send anything to my webhook endpoint.

    @Larsene above said: .......your production server NEED a valid ssl certificate but @ric-101 then said Indeed seems to be working after removing SSL!

    So, should it be a https URL with a valid SSL or a http URL without an SSL?

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

Metadata

Metadata

Labels

questionFurther information is requested

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions