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

Webhooks not working in production #368

Open
ric-101 opened this issue Nov 23, 2024 · 3 comments
Open

Webhooks not working in production #368

ric-101 opened this issue Nov 23, 2024 · 3 comments
Assignees
Labels
question Further information is requested

Comments

@ric-101
Copy link

ric-101 commented Nov 23, 2024

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

@ric-101 ric-101 added the question Further information is requested label Nov 23, 2024
@Larsene
Copy link

Larsene commented Nov 25, 2024

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 ?

@ric-101
Copy link
Author

ric-101 commented Nov 26, 2024

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!

@Larsene
Copy link

Larsene commented Nov 26, 2024

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....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

7 participants