Skip to content

feat: Sink url shortner for sms workflow reminders#26608

Merged
keithwillcode merged 19 commits intomainfrom
feat/sink_shortner_for_sms_reminders_workflows
Mar 16, 2026
Merged

feat: Sink url shortner for sms workflow reminders#26608
keithwillcode merged 19 commits intomainfrom
feat/sink_shortner_for_sms_reminders_workflows

Conversation

@Amit91848
Copy link
Member

@Amit91848 Amit91848 commented Jan 9, 2026

For dub fallback, add the following to .env before merging

What does this PR do?

Uses https://github.com/miantiao-me/sink hosted on cloudflare workers.

Fixes GTM-239

For testing you can add this in .env
SINK_API_URL=https://sink.amit-b43.workers.dev

SINK_API_KEY=(present in bitwarden under name Sink url shortner)

Dashboard: https://sink.amit-b43.workers.dev/dashboard/login
Pass: same as SINK_API_KEY present in bitwarden

Follow https://github.com/miantiao-me/Sink/blob/master/docs/deployment/workers.md for prod setup

  • Fixes #XXXX (GitHub issue number)
  • Fixes CAL-XXXX (Linear issue number - should be visible at the bottom of the GitHub issue description)

Visual Demo (For contributors especially)

Screen.Recording.2026-01-09.at.4.09.46.PM.mov

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

Summary by cubic

Adds a pluggable, user/team-aware URL shortener for SMS workflow reminders that prefers Sink (feature-flagged), then Dub, then original URLs. Removes hardcoded Dub settings and aligns with Linear GTM-239.

  • New Features

    • UrlShortenerFactory selects SinkShortener when sink-shortener is enabled (globally, per user, or per team via FeaturesRepository); else DubShortener; else NoopShortener. Used in ee/workflows/lib/reminders/utils, ee/workflows/api/scheduleSMSReminders, and smsReminderManager (now passes userId/teamId).
    • Shortening forwards optional DUB_SMS_DOMAIN/DUB_SMS_FOLDER_ID to Dub; .env.example documents SINK_API_URL/SINK_API_KEY and optional Dub SMS vars; lib/constants exports both Dub SMS values.
    • Adds sink-shortener flag to AppFlags/useFlags; seeds via migration. New @calcom/features/url-shortener module with SinkClient, providers, and factory; broad test coverage for shorteners, factory, reminder utils, and scheduleSMSReminders.
  • Migration

    • To use Sink, set SINK_API_URL and SINK_API_KEY, then enable the sink-shortener feature globally, per user, or per team.
    • If Dub is configured, it’s used; otherwise original URLs are sent. Optionally set DUB_SMS_DOMAIN and DUB_SMS_FOLDER_ID.

Written for commit ffbeac0. Summary will update on new commits.


Open with Devin

@github-actions github-actions bot added the ❗️ .env changes contains changes to env variables label Jan 9, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 7 files

@github-actions github-actions bot marked this pull request as draft January 9, 2026 10:55
@vercel
Copy link

vercel bot commented Jan 9, 2026

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

4 Skipped Deployments
Project Deployment Review Updated (UTC)
api-v2 Ignored Ignored Preview Jan 11, 2026 1:41am
cal Ignored Ignored Jan 11, 2026 1:41am
cal-companion Ignored Ignored Preview Jan 11, 2026 1:41am
cal-eu Ignored Ignored Jan 11, 2026 1:41am

@Amit91848 Amit91848 marked this pull request as ready for review January 9, 2026 12:17
cubic-dev-ai[bot]

This comment was marked as resolved.

@github-actions
Copy link
Contributor

This PR has been marked as stale due to inactivity. If you're still working on it or need any help, please let us know or update the PR to keep it active.

@github-actions github-actions bot added the Stale label Jan 19, 2026
@linear
Copy link

linear bot commented Feb 19, 2026

Copy link
Contributor

@Udit-takkar Udit-takkar left a comment

Choose a reason for hiding this comment

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

I am getting this error

b:dev: 09:26:09:241 [ERROR] sink-url-shortener Sink API error: 401 - {
@calcom/web:dev:   "error": true,
@calcom/web:dev:   "url": "https://sink.amit-b43.workers.dev/api/link/create",
@calcom/web:dev:   "statusCode": 401,
@calcom/web:dev:   "statusMessage": "Unauthorized",
@calcom/web:dev:   "message": ""
@calcom/web:dev: }

Copy link
Contributor

@Udit-takkar Udit-takkar left a comment

Choose a reason for hiding this comment

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

We should use a combination of strategy + factory pattern here and we should use global feature flags to decide which one to use and it would be easier to add more/ replace with another url shortner service.

For eg:-

export class SinkShortener implements IUrlShortenerProvider {
  constructor(private client: SinkClient) {}

  async shortenMany(urls: string[]) {
    const results = await this.client.createMany(urls);
    return results.map(r => ({
      shortLink: r.shortLink || r.url
    }));
  }
}

export class UrlShortenerFactory {
  static create(): IUrlShortenerProvider {
// Check feature flag here instead of env vars
    if (process.env.SINK_API_KEY) {
      return new SinkShortener(new SinkClient());
    }

    if (process.env.DUB_API_KEY) {
      return new DubShortener();
    }

    return new NoopShortener();
  }
}

@github-actions github-actions bot marked this pull request as draft February 23, 2026 09:40
@Udit-takkar
Copy link
Contributor

There is also

Circular dependency violation — packages/lib imports from @calcom/features/auth/lib/dub, violating the rule that packages/lib must never import from packages/features

@github-actions
Copy link
Contributor

Devin AI is resolving merge conflicts

This PR has merge conflicts with the main branch. A Devin session has been created to automatically resolve them.

View Devin Session

Devin will:

  1. Merge the latest main into this branch
  2. Resolve any conflicts intelligently
  3. Run lint/type checks to ensure validity
  4. Push the resolved changes

If you prefer to resolve conflicts manually, you can close the Devin session and handle it yourself.

@devin-ai-integration
Copy link
Contributor

Merge conflicts resolved and pushed. The single conflicted file (packages/features/ee/workflows/api/scheduleSMSReminders.test.ts) was resolved by combining both test suites - the PR branch's comprehensive handler tests and main's smsReminderNumber fallback tests - using shared UrlShortenerFactory mocks. All 39 tests pass.

Note: Unable to remove the devin-conflict-resolution label due to API authentication limitations. Please remove it manually.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 23, 2026

E2E results are ready!

@Amit91848 Amit91848 marked this pull request as ready for review February 26, 2026 06:21
Udit-takkar
Udit-takkar previously approved these changes Feb 26, 2026
@keithwillcode keithwillcode marked this pull request as draft February 26, 2026 13:43
@keithwillcode
Copy link
Contributor

We discussed internally and @Amit91848 is going to add a TeamFeatureFlag for this so we can slowly roll out.

@Amit91848 Amit91848 marked this pull request as ready for review February 27, 2026 15:14
@Amit91848 Amit91848 requested a review from a team as a code owner February 27, 2026 15:14
@github-actions github-actions bot removed the Stale label Mar 6, 2026
devin-ai-integration[bot]

This comment was marked as resolved.

@keithwillcode keithwillcode enabled auto-merge (squash) March 16, 2026 20:40
@keithwillcode keithwillcode merged commit 353f71b into main Mar 16, 2026
80 of 82 checks passed
@keithwillcode keithwillcode deleted the feat/sink_shortner_for_sms_reminders_workflows branch March 16, 2026 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core area: core, team members only devin-conflict-resolution ❗️ .env changes contains changes to env variables ❗️ migrations contains migration files ready-for-e2e size/XXL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants