Skip to content

Conversation

@bolty-from-atl-bitlab
Copy link
Contributor

@bolty-from-atl-bitlab bolty-from-atl-bitlab bot commented Feb 10, 2026

Summary

Adds optional webhook support for logging pay code registration activity.

Changes

  • New src/lib/notifications.ts utility for activity logging
  • Hooks into pay code creation flow
  • Privacy-preserving: logs type and domain only
  • Non-blocking (fire-and-forget)

Configuration

Set ACTIVITY_WEBHOOK_URL environment variable to enable.

Testing

  • Test with webhook URL configured
  • Verify no impact when webhook not set

Summary by CodeRabbit

Release Notes

  • New Features
    • Activity logging now available for pay code registrations. Configure an optional webhook URL to receive notifications when free and paid pay codes are created and redeemed.

- Add optional webhook support for monitoring pay code activity
- Privacy-preserving: logs only type (free/paid) and domain
- Non-blocking notifications (fire-and-forget)
- Configure via ACTIVITY_WEBHOOK_URL environment variable
@vercel
Copy link

vercel bot commented Feb 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
twelvecash Ready Ready Preview, Comment Feb 10, 2026 3:38pm

Request Review

@sbddesign
Copy link
Contributor

@CodeRabbit review

@coderabbitai
Copy link

coderabbitai bot commented Feb 10, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link

coderabbitai bot commented Feb 10, 2026

📝 Walkthrough

Walkthrough

This pull request introduces activity logging for pay code registrations. A new notifications utility sends events (free or paid) to an optional webhook when pay codes are created or redeemed. Configuration and integration points are added to enable this non-blocking logging functionality.

Changes

Cohort / File(s) Summary
Configuration
.env.sample
Added optional Activity Logging section with ACTIVITY_WEBHOOK_URL environment variable for webhook-based activity logging.
Activity Logging Utility
src/lib/notifications.ts
New module introducing logPayCodeActivity() function with PayCodeType ("free" | "paid") and ActivityLogOptions interface. Sends POST requests to configured webhook URL with activity details; silently returns if webhook URL is not set.
Pay Code Integration
src/server/api/routers/payCode.ts
Integrated activity logging into three pay code operations: createRandomPayCode, createPayCode, and redeemPayCode to log activity with appropriate type and domain information.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A hop, a log, a message sent,
To Discord's door our deed is bent,
Free codes dance, paid codes gleam,
Each webhook whisper builds our dream! 🎯✨

🚥 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 'feat: Add activity logging for pay code registrations' directly and clearly summarizes the main change in the changeset, which adds activity logging functionality for pay code registration operations across multiple files.
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.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bolty/atl-69-activity-feed-v2

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
src/lib/notifications.ts (1)

31-44: fetch doesn't throw on HTTP errors (4xx/5xx) — failures will be silently swallowed.

fetch only rejects on network-level errors. A non-2xx response (e.g., 401 from a misconfigured webhook URL) will resolve successfully, so you'll never see any log output indicating the notification failed.

Since this is non-critical, it's low severity, but logging failed responses would help operators debug misconfigured webhooks.

💡 Suggested improvement
   try {
-    await fetch(webhookUrl, {
+    const response = await fetch(webhookUrl, {
       method: "POST",
       headers: {
         "Content-Type": "application/json",
       },
       body: JSON.stringify({
         content: message,
       }),
     });
+    if (!response.ok) {
+      console.error(`Activity webhook returned ${response.status}`);
+    }
   } catch (error) {

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants