Skip to content

[client] add mms:downloaded webhook event support#42

Merged
capcom6 merged 1 commit intomasterfrom
client/mms-downloaded-webhook
Mar 19, 2026
Merged

[client] add mms:downloaded webhook event support#42
capcom6 merged 1 commit intomasterfrom
client/mms-downloaded-webhook

Conversation

@capcom6
Copy link
Copy Markdown
Member

@capcom6 capcom6 commented Mar 13, 2026

Summary by CodeRabbit

  • New Features

    • Added SMS sent and SMS received webhook events
    • Added MMS downloaded webhook event and retained MMS received
  • Refactor

    • Centralized webhook event ordering into a single source of truth to preserve consistent ordering
  • Enhancement

    • Webhook event list now returns a stable, ordered copy and uses a derived lookup for validation

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
smsgateway/domain_webhooks.go 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 13, 2026

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: 702ace14-34de-48c2-880a-f7d1660f5f7a

📥 Commits

Reviewing files that changed from the base of the PR and between 5a25f79 and a95f5ae.

📒 Files selected for processing (1)
  • smsgateway/domain_webhooks.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • smsgateway/domain_webhooks.go

Walkthrough

Reworked webhook event constants and registry in smsgateway/domain_webhooks.go: replaced an MMS-focused event with SMS-focused names, added sms:sent and mms:downloaded, introduced an ordered unexported slice webhookEventTypes as the single source of truth, derive the lookup map, and return a copy from WebhookEventTypes(). (50 words)

Changes

Cohort / File(s) Summary
Webhook event declarations & registry
smsgateway/domain_webhooks.go
Replaced mms:received-centric literal with SMS-centric constants (sms:received, sms:sent), added mms:downloaded; introduced ordered unexported slice webhookEventTypes and derive allEventTypes map from it; WebhookEventTypes() now returns a copy preserving order; validation uses derived lookup.

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the primary change: adding support for the new 'mms:downloaded' webhook event constant, which is the main addition in this changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

📝 Coding Plan
  • Generate coding plan for human review comments

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 and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
smsgateway/domain_webhooks.go (1)

22-31: Keep the event list single-sourced.

allEventTypes and WebhookEventTypes() now require the same manual edits. Deriving the lookup map from one backing slice would avoid validation and enumeration drifting apart the next time a webhook event is added.

♻️ Proposed refactor
+var webhookEventTypes = []WebhookEvent{
+	WebhookEventSmsReceived,
+	WebhookEventSmsDataReceived,
+	WebhookEventSmsSent,
+	WebhookEventSmsDelivered,
+	WebhookEventSmsFailed,
+	WebhookEventSystemPing,
+	WebhookEventMmsReceived,
+	WebhookEventMmsDownloaded,
+}
+
 //nolint:gochecknoglobals // lookup table
-var allEventTypes = map[WebhookEvent]struct{}{
-	WebhookEventSmsReceived:     {},
-	WebhookEventSmsDataReceived: {},
-	WebhookEventSmsSent:         {},
-	WebhookEventSmsDelivered:    {},
-	WebhookEventSmsFailed:       {},
-	WebhookEventSystemPing:      {},
-	WebhookEventMmsReceived:     {},
-	WebhookEventMmsDownloaded:   {},
-}
+var allEventTypes = func() map[WebhookEvent]struct{} {
+	m := make(map[WebhookEvent]struct{}, len(webhookEventTypes))
+	for _, event := range webhookEventTypes {
+		m[event] = struct{}{}
+	}
+	return m
+}()
 
 // WebhookEventTypes returns a slice of all supported webhook event types.
 func WebhookEventTypes() []WebhookEvent {
-	return []WebhookEvent{
-		WebhookEventSmsReceived,
-		WebhookEventSmsDataReceived,
-		WebhookEventSmsSent,
-		WebhookEventSmsDelivered,
-		WebhookEventSmsFailed,
-		WebhookEventSystemPing,
-		WebhookEventMmsReceived,
-		WebhookEventMmsDownloaded,
-	}
+	return append([]WebhookEvent(nil), webhookEventTypes...)
 }

Also applies to: 34-44

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@smsgateway/domain_webhooks.go` around lines 22 - 31, The event list is
duplicated between the allEventTypes map and WebhookEventTypes(), causing drift;
consolidate to a single source (e.g., define a slice variable like
allEventTypeList or webhookEventList containing WebhookEvent values) and derive
both the lookup map (allEventTypes) and the WebhookEventTypes() return from that
single slice (build the map in init or lazily from the slice). Update references
to use the new slice name and remove the duplicated literal lists (also apply
the same change for the similar block referenced at lines 34-44).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@smsgateway/domain_webhooks.go`:
- Around line 22-31: The event list is duplicated between the allEventTypes map
and WebhookEventTypes(), causing drift; consolidate to a single source (e.g.,
define a slice variable like allEventTypeList or webhookEventList containing
WebhookEvent values) and derive both the lookup map (allEventTypes) and the
WebhookEventTypes() return from that single slice (build the map in init or
lazily from the slice). Update references to use the new slice name and remove
the duplicated literal lists (also apply the same change for the similar block
referenced at lines 34-44).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cf8000b6-bd61-40af-a423-010b3326805f

📥 Commits

Reviewing files that changed from the base of the PR and between 22cfdb8 and 02eb787.

📒 Files selected for processing (1)
  • smsgateway/domain_webhooks.go

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@smsgateway/domain_webhooks.go`:
- Line 33: Update the nolint comment to reference the correct identifier:
replace "allWebhookEvents" with "webhookEventTypes" in the comment on the global
lookup table so the nolint annotation accurately reflects the actual source
variable (ensure the gochecknoglobals directive remains intact and only the
identifier text is corrected near the global lookup table declaration).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4901690a-ac8a-4736-96fb-f3c6dd243230

📥 Commits

Reviewing files that changed from the base of the PR and between 02eb787 and 464a0c7.

📒 Files selected for processing (1)
  • smsgateway/domain_webhooks.go

Comment thread smsgateway/domain_webhooks.go Outdated
@capcom6 capcom6 force-pushed the client/mms-downloaded-webhook branch from 5a25f79 to a95f5ae Compare March 15, 2026 09:58
@capcom6
Copy link
Copy Markdown
Member Author

capcom6 commented Mar 16, 2026

Waiting for app release...

@capcom6 capcom6 added the ready label Mar 16, 2026
@capcom6 capcom6 merged commit f83a97a into master Mar 19, 2026
8 checks passed
@capcom6 capcom6 deleted the client/mms-downloaded-webhook branch March 19, 2026 00:51
@coderabbitai coderabbitai Bot mentioned this pull request Apr 11, 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