Skip to content

[api] add support for batch webhooks#247

Open
capcom6 wants to merge 1 commit into
masterfrom
api/batch-webhooks
Open

[api] add support for batch webhooks#247
capcom6 wants to merge 1 commit into
masterfrom
api/batch-webhooks

Conversation

@capcom6

@capcom6 capcom6 commented Jul 2, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features

    • Added configurable webhookDelivery modes (Disabled, Individual, Batch) for inbox refresh and related message export webhook behavior.
    • Extended webhook event variants and added new work-hours settings for message receiving.
  • Bug Fixes

    • Webhook triggering behavior now consistently follows the selected webhookDelivery mode instead of the legacy boolean.
  • Documentation

    • Updated generated OpenAPI/Swagger to introduce webhookDelivery, deprecate triggerWebhooks, and refresh related schemas.
  • Chores

    • Updated a Go dependency and refreshed generated documentation.

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 033e019f-f0db-49ae-b44e-32b2b91bb099

📥 Commits

Reviewing files that changed from the base of the PR and between 1621f50 and 93d4331.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (6)
  • go.mod
  • internal/sms-gateway/handlers/inbox/3rdparty.go
  • internal/sms-gateway/handlers/messages/3rdparty.go
  • internal/sms-gateway/inbox/service.go
  • internal/sms-gateway/modules/events/events.go
  • internal/sms-gateway/openapi/docs.go
✅ Files skipped from review due to trivial changes (1)
  • internal/sms-gateway/openapi/docs.go
🚧 Files skipped from review as they are similar to previous changes (5)
  • internal/sms-gateway/inbox/service.go
  • internal/sms-gateway/modules/events/events.go
  • go.mod
  • internal/sms-gateway/handlers/messages/3rdparty.go
  • internal/sms-gateway/handlers/inbox/3rdparty.go

📝 Walkthrough

Walkthrough

This PR replaces the nullable triggerWebhooks flow with smsgateway.WebhookDelivery for inbox refresh handling, updates the related OpenAPI docs and generated schema, and bumps github.com/android-sms-gateway/client-go.

Changes

WebhookDelivery refresh flow

Layer / File(s) Summary
Refresh flow uses WebhookDelivery
internal/sms-gateway/handlers/inbox/3rdparty.go, internal/sms-gateway/handlers/messages/3rdparty.go, internal/sms-gateway/inbox/service.go, internal/sms-gateway/modules/events/events.go
ThirdPartyController.refresh, postInboxExport, Service.Refresh, and NewMessagesExportRequestedEvent now pass and consume smsgateway.WebhookDelivery, and the event payload always includes webhookDelivery while deriving triggerWebhooks from it.
OpenAPI and dependency updates
go.mod, internal/sms-gateway/openapi/docs.go
client-go is updated; the generated OpenAPI document marks triggerWebhooks deprecated, adds webhookDelivery, adds the WebhookDelivery schema, extends WebhookEvent, and adds new SettingsMessages work-hours fields.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant ThirdPartyController
  participant InboxService
  participant Events

  Client->>ThirdPartyController: POST inbox refresh/export
  ThirdPartyController->>ThirdPartyController: ResolveWebhookDelivery()
  ThirdPartyController->>InboxService: Refresh(webhookDelivery)
  InboxService->>Events: NewMessagesExportRequestedEvent(webhookDelivery)
  Events-->>InboxService: Event payload
  InboxService-->>ThirdPartyController: result
Loading

Possibly related PRs

  • android-sms-gateway/server#224: Both PRs modify the inbox refresh/export pipeline at the same code points—Service.Refresh and events.NewMessagesExportRequestedEvent—changing webhook-triggering request/event payloads.
  • android-sms-gateway/server#229: Both PRs change postInboxExport’s h.inboxSvc.Refresh(...) call in internal/sms-gateway/handlers/messages/3rdparty.go.
  • android-sms-gateway/server#179: Both PRs touch internal/sms-gateway/openapi/docs.go by updating WebhookEvent enum values and metadata.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: API support for batch webhooks via the new webhook delivery mode.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
internal/sms-gateway/openapi/docs.go (1)

484-484: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Stale endpoint description references only the deprecated field.

The /3rdparty/v1/inbox/refresh description still says the webhook trigger depends on triggerWebhooks, but this file now documents the new webhookDelivery field (and marks triggerWebhooks deprecated) a few hundred lines later. Update the underlying Go doc comment in the handler (not shown in this diff) that generates this swagger description, so it reflects webhookDelivery as the primary control.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/sms-gateway/openapi/docs.go` at line 484, The
`/3rdparty/v1/inbox/refresh` swagger description is stale and still mentions
only the deprecated triggerWebhooks flag. Update the Go doc comment on the
handler that generates this OpenAPI text so it describes webhookDelivery as the
primary control, while still acknowledging triggerWebhooks only as deprecated if
needed; use the refresh endpoint handler and its generated docs source to locate
the comment.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@internal/sms-gateway/openapi/docs.go`:
- Line 484: The `/3rdparty/v1/inbox/refresh` swagger description is stale and
still mentions only the deprecated triggerWebhooks flag. Update the Go doc
comment on the handler that generates this OpenAPI text so it describes
webhookDelivery as the primary control, while still acknowledging
triggerWebhooks only as deprecated if needed; use the refresh endpoint handler
and its generated docs source to locate the comment.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0073990f-bbb5-47d6-9cf1-3576a9705d9b

📥 Commits

Reviewing files that changed from the base of the PR and between 88a880f and 4964bee.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (6)
  • go.mod
  • internal/sms-gateway/handlers/inbox/3rdparty.go
  • internal/sms-gateway/handlers/messages/3rdparty.go
  • internal/sms-gateway/inbox/service.go
  • internal/sms-gateway/modules/events/events.go
  • internal/sms-gateway/openapi/docs.go

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

🤖 Pull request artifacts

Platform File
🐳 Docker GitHub Container Registry
🍎 Darwin arm64 server_Darwin_arm64.tar.gz
🍎 Darwin x86_64 server_Darwin_x86_64.tar.gz
🐧 Linux arm64 server_Linux_arm64.tar.gz
🐧 Linux i386 server_Linux_i386.tar.gz
🐧 Linux x86_64 server_Linux_x86_64.tar.gz
🪟 Windows arm64 server_Windows_arm64.zip
🪟 Windows i386 server_Windows_i386.zip
🪟 Windows x86_64 server_Windows_x86_64.zip

@github-actions github-actions Bot removed the ready label Jul 2, 2026
@coderabbitai coderabbitai Bot removed the codex label Jul 2, 2026
@capcom6 capcom6 force-pushed the api/batch-webhooks branch 2 times, most recently from 8239b7c to 2712c9f Compare July 4, 2026 00:33
@capcom6 capcom6 added the ready label Jul 5, 2026
@capcom6 capcom6 force-pushed the api/batch-webhooks branch from 2712c9f to a72cf83 Compare July 8, 2026 01:26
@github-actions github-actions Bot removed the ready label Jul 8, 2026
@capcom6 capcom6 added the ready label Jul 8, 2026
@capcom6 capcom6 force-pushed the api/batch-webhooks branch from a72cf83 to 61b837a Compare July 9, 2026 00:58
@github-actions github-actions Bot removed the ready label Jul 9, 2026
@capcom6 capcom6 force-pushed the api/batch-webhooks branch from 1621f50 to 93d4331 Compare July 9, 2026 08:36
@capcom6 capcom6 added the ready label Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant