The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Serve campaign unsubscribe and tracked links on links.<domain> (#28915)
neo773ba29ee4f5b2d
diff --git a/packages/twenty-docs/user-guide/calendar-emails/capabilities/email-channels.mdx b/packages/twenty-docs/user-guide/calendar-emails/capabilities/email-channels.mdxindex 50e50364e0e..9af03855abb 100644--- a/packages/twenty-docs/user-guide/calendar-emails/capabilities/email-channels.mdx+++ b/packages/twenty-docs/user-guide/calendar-emails/capabilities/email-channels.mdx@@ -90,13 +90,13 @@ Your team can now reply from the shared address. For provider-specific instructi## Stage 3: Send campaigns-Every campaign includes an unsubscribe link. Twenty hosts the unsubscribe page on your own domain, such as `unsubscribe.yourcompany.com`, so recipients see your brand rather than ours.+Every campaign includes an unsubscribe link. Twenty hosts the unsubscribe page on your own domain, such as `links.yourcompany.com`, so recipients see your brand rather than ours.<Steps><Step title="Add the unsubscribe records">In the same **Sending domain** section, add the two `CNAME` records listed- under **Unsubscribe link**: one on `unsubscribe` and one on- `_acme-challenge.unsubscribe`.+ under **Unsubscribe link**: one on `links` and one on+ `_acme-challenge.links`.</Step><Step title="Verify">Click **Check verification**. **Unsubscribe link** changes to **Verified**,diff --git a/packages/twenty-docs/user-guide/email-campaigns/how-tos/manage-unsubscribes-and-topics.mdx b/packages/twenty-docs/user-guide/email-campaigns/how-tos/manage-unsubscribes-and-topics.mdxindex 61388d7af7b..66e1a445dd9 100644--- a/packages/twenty-docs/user-guide/email-campaigns/how-tos/manage-unsubscribes-and-topics.mdx+++ b/packages/twenty-docs/user-guide/email-campaigns/how-tos/manage-unsubscribes-and-topics.mdx@@ -16,7 +16,7 @@ Every campaign email includes:- A line in the footer: "Don't want these emails? Unsubscribe."- The one-click unsubscribe headers that Gmail, Yahoo and other email apps use to show their own **Unsubscribe** button.-The link opens an unsubscribe page on your domain, for example `unsubscribe.yourcompany.com`:+The link opens an unsubscribe page on your domain, for example `links.yourcompany.com`:- **No public topics**: people see one **Unsubscribe** button.- **Public topics**: people see one checkbox for each topic. They can untick topics and click **Update**, or click **Unsubscribe all**.diff --git a/packages/twenty-docs/user-guide/email-campaigns/how-tos/set-up-a-sending-domain.mdx b/packages/twenty-docs/user-guide/email-campaigns/how-tos/set-up-a-sending-domain.mdxindex 70de67b06d4..bde325becc6 100644--- a/packages/twenty-docs/user-guide/email-campaigns/how-tos/set-up-a-sending-domain.mdx+++ b/packages/twenty-docs/user-guide/email-campaigns/how-tos/set-up-a-sending-domain.mdx@@ -15,7 +15,7 @@ Only replying from a shared inbox, not sending campaigns? You can skip the unsub<Note>Twenty's records use their own host names, such as- `twenty-bounce.yourcompany.com` and `unsubscribe.yourcompany.com`. They do not+ `twenty-bounce.yourcompany.com` and `links.yourcompany.com`. They do notchange the records your day-to-day email relies on, so you can use your maindomain. The only exception is DMARC, which applies to the whole domain.Twenty suggests it only when you do not already have one.@@ -67,7 +67,7 @@ Twenty opens the channel. Scroll to **Sending domain**. It lists the DNS records| ------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ || **Domain authentication** | Three `CNAME` records ending in `._domainkey`, plus an `MX` and a `TXT` record on `twenty-bounce` | Shows that Twenty can send for your domain (DKIM and SPF). The `twenty-bounce` records also send bounce reports back to Twenty. || **DMARC policy** | One `TXT` record on `_dmarc` | Tells providers what to do with mail that fails the checks. Twenty only lists it if you do not have a DMARC record. |-| **Unsubscribe link** | Two `CNAME` records, on `unsubscribe` and `_acme-challenge.unsubscribe` | Hosts the unsubscribe page on your domain, for example `unsubscribe.yourcompany.com`. You cannot send campaigns until this is verified. |+| **Unsubscribe link** | Two `CNAME` records, on `links` and `_acme-challenge.links` | Hosts the unsubscribe page and tracked links on your domain, for example `links.yourcompany.com`. You cannot send campaigns until this is verified. |Add every record Twenty shows. Gmail, Yahoo, and Outlook reject bulk email that is not authenticated.@@ -161,7 +161,7 @@ The **DMARC policy** row always shows **Not set**. That is expected: Twenty sugg<Accordion title="Authentication is verified but the Unsubscribe link stays Pending">The two unsubscribe records are checked separately and can take longer becauseTwenty also creates a secure certificate for them. Check that both `CNAME`- records exist—on `unsubscribe` and `_acme-challenge.unsubscribe`—then wait up+ records exist—on `links` and `_acme-challenge.links`—then wait upto an hour.</Accordion>diff --git a/packages/twenty-front/src/modules/settings/emailing-domains/utils/getVerificationRecordGroupKey.ts b/packages/twenty-front/src/modules/settings/emailing-domains/utils/getVerificationRecordGroupKey.tsindex 92d43c14a91..07f662360f1 100644--- a/packages/twenty-front/src/modules/settings/emailing-domains/utils/getVerificationRecordGroupKey.ts+++ b/packages/twenty-front/src/modules/settings/emailing-domains/utils/getVerificationRecordGroupKey.ts@@ -11,7 +11,10 @@ export const getVerificationRecordGroupKey = ({return 'DMARC';}- if (recordName.endsWith(`unsubscribe.${domain}`)) {+ if (+ recordName.endsWith(`links.${domain}`) ||+ recordName.endsWith(`unsubscribe.${domain}`)+ ) {return 'UNSUBSCRIBE';}diff --git a/packages/twenty-server/src/engine/core-modules/emailing-domain/constants/recipient-links-hostname-prefix.constant.ts b/packages/twenty-server/src/engine/core-modules/emailing-domain/constants/recipient-links-hostname-prefix.constant.tsnew file mode 100644index 00000000000..1affd8cc8c5--- /dev/null+++ b/packages/twenty-server/src/engine/core-modules/emailing-domain/constants/recipient-links-hostname-prefix.constant.ts@@ -0,0 +1 @@+export const RECIPIENT_LINKS_HOSTNAME_PREFIX = 'links';diff --git a/packages/twenty-server/src/engine/core-modules/emailing-domain/constants/unsubscribe-hostname-prefix.constant.ts b/packages/twenty-server/src/engine/core-modules/emailing-domain/constants/unsubscribe-hostname-prefix.constant.tsdeleted file mode 100644index d3271cb82e4..00000000000--- a/packages/twenty-server/src/engine/core-modules/emailing-domain/constants/unsubscribe-hostname-prefix.constant.ts+++ /dev/null@@ -1 +0,0 @@-export const UNSUBSCRIBE_HOSTNAME_PREFIX = 'unsubscribe';diff --git a/packages/twenty-server/src/engine/core-modules/emailing-domain/drivers/log/services/log-emailing-domain-driver.service.ts b/packages/twenty-server/src/engine/core-modules/emailing-domain/drivers/log/services/log-emailing-domain-driver.service.tsindex ffe42751b6d..9a54597f9b3 100644--- a/packages/twenty-server/src/engine/core-modules/emailing-domain/drivers/log/services/log-emailing-domain-driver.service.ts+++ b/packages/twenty-server/src/engine/core-modules/emailing-domain/drivers/log/services/log-emailing-domain-driver.service.ts@@ -9,7 +9,7 @@ import {EmailingDomainDriverException,EmailingDomainDriverExceptionCode,} from 'src/engine/core-modules/emailing-domain/drivers/exceptions/emailing-domain-driver.exception';-import { UNSUBSCRIBE_HOSTNAME_PREFIX } from 'src/engine/core-modules/emailing-domain/constants/unsubscribe-hostname-prefix.constant';+import { RECIPIENT_LINKS_HOSTNAME_PREFIX } from 'src/engine/core-modules/emailing-domain/constants/recipient-links-hostname-prefix.constant';import { buildLogDriverUnsubscribeBaseUrl } from 'src/engine/core-modules/emailing-domain/drivers/log/utils/build-log-driver-unsubscribe-base-url.util';import {type EmailingDomainDriverInterface,@@ -95,13 +95,13 @@ export class LogEmailingDomainDriver implements EmailingDomainDriverInterface {},{type: 'CNAME',- key: `${UNSUBSCRIBE_HOSTNAME_PREFIX}.${domain}`,+ key: `${RECIPIENT_LINKS_HOSTNAME_PREFIX}.${domain}`,value: `app.localhost`,status: 'pending',},{type: 'CNAME',- key: `_acme-challenge.${UNSUBSCRIBE_HOSTNAME_PREFIX}.${domain}`,+ key: `_acme-challenge.${RECIPIENT_LINKS_HOSTNAME_PREFIX}.${domain}`,value: `${domain}.dcv.cloudflare.example`,status: 'error',},diff --git a/packages/twenty-server/src/engine/core-modules/emailing-domain/drivers/log/utils/build-log-driver-unsubscribe-base-url.util.ts b/packages/twenty-server/src/engine/core-modules/emailing-domain/drivers/log/utils/build-log-driver-unsubscribe-base-url.util.tsindex 928ea14d876..059855d657a 100644--- a/packages/twenty-server/src/engine/core-modules/emailing-domain/drivers/log/utils/build-log-driver-unsubscribe-base-url.util.ts+++ b/packages/twenty-server/src/engine/core-modules/emailing-domain/drivers/log/utils/build-log-driver-unsubscribe-base-url.util.ts@@ -1,4 +1,4 @@-import { UNSUBSCRIBE_HOSTNAME_PREFIX } from 'src/engine/core-modules/emailing-domain/constants/unsubscribe-hostname-prefix.constant';+import { RECIPIENT_LINKS_HOSTNAME_PREFIX } from 'src/engine/core-modules/emailing-domain/constants/recipient-links-hostname-prefix.constant';export const buildLogDriverUnsubscribeBaseUrl = ({serverUrl,@@ -12,8 +12,8 @@ export const buildLogDriverUnsubscribeBaseUrl = ({const baseUrl = new URL(serverUrl);baseUrl.hostname = isMultiWorkspaceEnabled- ? `${UNSUBSCRIBE_HOSTNAME_PREFIX}.${subdomain}.${baseUrl.hostname}`- : `${UNSUBSCRIBE_HOSTNAME_PREFIX}.${baseUrl.hostname}`;+ ? `${RECIPIENT_LINKS_HOSTNAME_PREFIX}.${subdomain}.${baseUrl.hostname}`+ : `${RECIPIENT_LINKS_HOSTNAME_PREFIX}.${baseUrl.hostname}`;return baseUrl.origin;};diff --git a/packages/twenty-server/src/engine/core-modules/emailing-domain/services/unsubscribe-hostname.service.ts b/packages/twenty-server/src/engine/core-modules/emailing-domain/services/unsubscribe-hostname.service.tsindex c9fdf23ec1d..18d0bfc925d 100644--- a/packages/twenty-server/src/engine/core-modules/emailing-domain/services/unsubscribe-hostname.service.ts+++ b/packages/twenty-server/src/engine/core-modules/emailing-domain/services/unsubscribe-hostname.service.ts@@ -8,7 +8,7 @@ import {DnsManagerException,DnsManagerExceptionCode,} from 'src/engine/core-modules/dns-manager/exceptions/dns-manager.exception';-import { UNSUBSCRIBE_HOSTNAME_PREFIX } from 'src/engine/core-modules/emailing-domain/constants/unsubscribe-hostname-prefix.constant';+import { RECIPIENT_LINKS_HOSTNAME_PREFIX } from 'src/engine/core-modules/emailing-domain/constants/recipient-links-hostname-prefix.constant';import { UnsubscribeHostnameStatus } from 'src/engine/core-modules/emailing-domain/drivers/types/unsubscribe-hostname-status.type';import { type VerificationRecord } from 'src/engine/core-modules/emailing-domain/drivers/types/verifications-record.type';import { EmailingDomainEntity } from 'src/engine/core-modules/emailing-domain/emailing-domain.entity';@@ -212,6 +212,6 @@ export class UnsubscribeHostnameService {}private buildHostname(domain: string): string {- return `${UNSUBSCRIBE_HOSTNAME_PREFIX}.${domain}`;+ return `${RECIPIENT_LINKS_HOSTNAME_PREFIX}.${domain}`;}}diff --git a/packages/twenty-server/src/engine/workspace-manager/dev-seeder/core/utils/seed-emailing-domains.util.ts b/packages/twenty-server/src/engine/workspace-manager/dev-seeder/core/utils/seed-emailing-domains.util.tsindex 80f65863d36..f7bfbd09fbe 100644--- a/packages/twenty-server/src/engine/workspace-manager/dev-seeder/core/utils/seed-emailing-domains.util.ts+++ b/packages/twenty-server/src/engine/workspace-manager/dev-seeder/core/utils/seed-emailing-domains.util.ts@@ -1,6 +1,6 @@import { type QueryRunner } from 'typeorm';-import { UNSUBSCRIBE_HOSTNAME_PREFIX } from 'src/engine/core-modules/emailing-domain/constants/unsubscribe-hostname-prefix.constant';+import { RECIPIENT_LINKS_HOSTNAME_PREFIX } from 'src/engine/core-modules/emailing-domain/constants/recipient-links-hostname-prefix.constant';import { EmailingDomainStatus } from 'src/engine/core-modules/emailing-domain/drivers/types/emailing-domain-status.type';import { EmailingDomainTenantStatus } from 'src/engine/core-modules/emailing-domain/drivers/types/emailing-domain-tenant-status.type';import { UnsubscribeHostnameStatus } from 'src/engine/core-modules/emailing-domain/drivers/types/unsubscribe-hostname-status.type';@@ -53,7 +53,7 @@ export const seedEmailingDomains = async ({verificationRecords: [],verifiedAt: new Date(),tenantStatus: EmailingDomainTenantStatus.ACTIVE,- unsubscribeHostname: `${UNSUBSCRIBE_HOSTNAME_PREFIX}.${verified}`,+ unsubscribeHostname: `${RECIPIENT_LINKS_HOSTNAME_PREFIX}.${verified}`,unsubscribeHostnameStatus: UnsubscribeHostnameStatus.ACTIVE,},{