HC WebhookHC Webhook
Bug
completed

Fix webhook sync HTTP 302 failure

mochi·Jul 10, 2026

Hi, thank you for maintaining Health Connect Webhook.

I am using v1.9.14 with a Google Apps Script Web App endpoint like:

https://script.google.com/macros/s/.../exec?token=...

Since v1.9.14, webhook sync fails with HTTP 302. The same Google Apps Script webhook worked on v1.5.

Example log:

  • statusCode: 302
  • success: false
  • errorMessage: HTTP 302:
  • syncType: manual
  • app_version in payload: 1.9.14

Google Apps Script Web Apps commonly redirect /exec requests to script.googleusercontent.com with a 302 response before returning the final response. It looks like v1.9.14 currently disables redirect following in WebhookManager.kt:

Kotlinprivate val client = OkHttpClient.Builder()
    .connectTimeout(TIMEOUT_SECONDS, TimeUnit.SECONDS)
    .readTimeout(TIMEOUT_SECONDS, TimeUnit.SECONDS)
    .writeTimeout(TIMEOUT_SECONDS, TimeUnit.SECONDS)
    .followRedirects(false)
    .build()

In v1.5 this line was not present, so OkHttp followed redirects by default and Google Apps Script webhooks worked.

Request:

Could you please allow webhook delivery to follow redirects again, or add an option to enable redirect following per webhook?

A minimal fix appears to be removing:

Kotlin.followRedirects(false)

This would restore OkHttp's default redirect behavior and should fix Google Apps Script endpoints that return 302 before the final 2xx response.

If possible, it would also be helpful if webhook logs included the Location header for 3xx responses, so redirect issues are easier to diagnose.

Thank you!

Thanks for the detailed report — you were spot on. Redirect following was turned off in a later release, which made Google Apps Script /exec endpoints fail on their normal 302 to script.googleusercontent.com. This is fixed in v1.9.15: webhook delivery follows redirects again (OkHttp default), and if a 3xx still surfaces in logs, the Location header is included to make diagnosis easier. Your existing Apps Script webhook URL should work again after updating — no config change needed.

Powered by FeedbackJar