Files
Amit SharmaGitHubDevin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>Keith Williams
353f71bdc6 feat: Sink url shortner for sms workflow reminders (#26608)
* feat: Sink url shortner for sms workflow reminders

* fix: remove hardcoded dub values

* update .env.example

* fix: unit tests

* chore: add tests for scheduleSmsReminder and utils

* review refactor

* fix: type check

* review refactor

* fix: update test to account for smsReminderNumber fallback from main

Co-Authored-By: unknown <>

* feat: add feature flag for sink and more tests to verify

* fix: type check

* use proper feature flags for sink

* Apply suggestion from @keithwillcode

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Keith Williams <[email protected]>
2026-03-16 20:51:28 +00:00

26 lines
904 B
TypeScript

import logger from "@calcom/lib/logger";
import type { IUrlShortenerProvider, ShortenOptions, ShortenResult } from "../IUrlShortenerProvider";
import type { SinkClient } from "./SinkClient";
const log = logger.getSubLogger({ prefix: ["sink-shortener"] });
export class SinkShortener implements IUrlShortenerProvider {
constructor(private client: SinkClient) {}
static isConfigured(): boolean {
return Boolean(process.env.SINK_API_URL && process.env.SINK_API_KEY);
}
async shortenMany(urls: string[], _options?: ShortenOptions): Promise<ShortenResult[]> {
try {
const results = await this.client.createMany(urls);
return results.map((result) => ({
shortLink: result.shortLink || result.url,
}));
} catch (error) {
log.error("Sink shortening failed, returning original URLs", error);
return urls.map((url) => ({ shortLink: url }));
}
}
}