SCALIX help

← All tools

lads_create_engagement_rule

LinkedIn Ads write medium risk

Part of the LinkedIn Audience Agent.

What it does

Create an engagement-retargeting rule on a DMP segment so it auto-populates from ad/video engagement. POST /rest/dmpSegments/{id}/engagementRules with body {engagementSource, engagementTrigger, timeFrame:{timeSpan:{duration, unit}}}. engagementSource is the content URN members engage with (urn:li:sponsoredCampaign / urn:li:campaignGroup / urn:li:organization); engagementTrigger is a urn:li:dmpEngagementTrigger:(urn:li:dmpEngagementSourceType:<TYPE>,<TRIGGER>) (fetch the valid source-types/triggers from LinkedIn first); timeFrame is a rolling window (e.g. 90 days). Preview->approve->execute->log: show source, trigger, and window; on approval, create. The retargeting audience builds over time and must reach >=300 members to serve. Member-derived engagement data is subject to retention limits. Without rw_dmp_segments, which Scalix requests only once LinkedIn approves its Audiences program (SCALIX_LINKEDIN_EXTRA_SCOPES), the call is refused at preview (access_gated). Two-phase (parity with Google, ADR-028/029): the first call (no preview_id) reads the segment from LinkedIn (a missing segment, or one in an ad account the user has not enabled, is refused) and, for a sponsoredCampaign or sponsoredCampaignGroup source, that source within the segment's ad account (one outside it is refused), builds the request locally and returns a preview_id — nothing is changed on LinkedIn; re-call with that preview_id and identical arguments to COMMIT (single-use, 30-min; a changed/forged/replayed token fails closed).

When to use it

Use to build a retargeting audience from video viewers, lead-form openers, page visitors, or ad engagers. Confirm the source object and engagement type, then create. Do NOT retarget on engagement sources outside the bearer's account scope.

Inputs

NameTypeRequiredDescription
segment_idstringyesDMP segment id the engagement audience populates into (retargeting segment). Numeric; strip urn prefix.
engagement_sourcestringyesengagementSource URN — the content members engage with: urn:li:sponsoredCampaign:{id}, urn:li:campaignGroup:{id}, or urn:li:organization:{id}. Must belong to the scoped account.
engagement_triggerstringyesengagementTrigger URN, e.g. urn:li:dmpEngagementTrigger:(urn:li:dmpEngagementSourceType:VIDEO_ADS,FIRST_QUARTILE). Use only an ACTIVE source-type+trigger pair from LinkedIn's supported-engagement endpoints.
durationintegernotimeFrame.timeSpan length (rolling window), e.g. 90. Pair with unit.
unitstringnotimeFrame.timeSpan unit: DAY (default), WEEK, or MONTH.
preview_idstringnoOmit it to preview: nothing is applied, and the call returns a preview_id bound to this exact request. Pass it only after the user approves that preview in a later message, with the same arguments (leave out validate_only, and add any confirmation flag the preview names). Single-use, expires in 30 minutes; changed arguments need a fresh preview.

Safeguards

A change in two steps. The first call previews and changes nothing; Claude shows you the preview and applies it only after you approve, within 30 minutes and with the same arguments. Every applied change goes to the audit log. How changes are approved.

Policy

Engagement retargeting uses member activity data; honor retention/usage limits and use it only for the authorizing client's campaigns. Anti-discrimination rules apply to the resulting audience. The source object must belong to the bearer's scoped account. Serves only at >=300 members.

Reminder

Engagement-derived member data is for this client only and subject to retention limits; audience serves at >=300 members.

Errors

Error classMeansWhat to doRetry
INVALID_ARGUMENTBad engagementSource/engagementTrigger URN or invalid timeFrame (400) — surface message.Fix the source/trigger URN or timeFrame per the surfaced message; use a valid ACTIVE source-type+trigger pair.no
PERMISSION_DENIEDNo write access to segment/source or missing rw_dmp_segments (403).Verify role/scope and that the source belongs to the scoped account; re-auth if needed.no
NOT_FOUNDSegment or source object not found (404).Confirm the segment id and source URN.no
RESOURCE_EXHAUSTEDRate limit (429).Backoff 5/10/20s cap 60s; respect Retry-After.yes
TOKEN_REVOKEDToken expired/revoked (401).Refresh and retry once; else re-auth.yes
PLATFORM_ERRORLinkedIn 5xx.Retry with backoff.yes

Edge cases

  • Audience builds over time from future + lookback engagement -> warn it starts near-empty and won't serve below 300.
  • Source object in another account -> hard block (per-account isolation).
  • The engagementTrigger URN encodes both the source-type and the action (e.g. VIDEO_ADS + FIRST_QUARTILE) — pick a valid ACTIVE pair; there is no separate threshold field.
  • Lead-form-open retargeting is still subject to lead-data retention limits.
  • Duplicate rule on the same source/type may double-count — warn if one already exists.