PluginBench
Skill
Pass
Audit score 90

integration-eventing-subscription-configure

forcedotcom/sf-skills

Create, read, update, and delete ManagedEventSubscription metadata for Salesforce platform event subscriptions.

What is integration-eventing-subscription-configure?

This skill manages ManagedEventSubscription metadata in Salesforce, enabling you to configure managed event subscriptions with replay tracking, event channel subscribers, and subscription lifecycle operations. Use it when you need to subscribe to platform events, set up event replay, or modify subscription state—but not for creating the underlying event channel itself.

  • Generate .managedEventSubscription-meta.xml files for create, read, update, and delete operations
  • Configure replay presets (LATEST or EARLIEST) for default and error-recovery scenarios
  • Set subscription state to RUN (active) or STOP (inactive)
  • Identify subscriptions by DeveloperName or Tooling API Id
  • Validate topic name formats for platform events, change events, and custom channels
  • Provide destructive change guidance for subscription deletion

How to install integration-eventing-subscription-configure

npx skills add https://github.com/forcedotcom/sf-skills --skill integration-eventing-subscription-configure
Prerequisites
  • Salesforce CLI (sf) version 2.0.0 or later
  • Target org with API version 60.0 or higher
  • Existing platform event channel, change event, or custom event channel in the org (this skill does not create the channel itself)
  • Tooling API access to query or identify subscriptions by Id
Claude Code
Cursor
Windsurf
Cline

How to use integration-eventing-subscription-configure

  1. 1.Confirm the operation type: create, read, update, or delete
  2. 2.For create: gather DeveloperName (alphanumeric, underscores only), label, topicName, and replay presets; verify the event channel already exists in the org
  3. 3.For read/update/delete: identify the subscription by DeveloperName or Tooling API Id
  4. 4.Generate or retrieve the .managedEventSubscription-meta.xml file using the skill
  5. 5.For create/update: verify all six required elements (topicName, defaultReplay, errorRecoveryReplay, label, state, version) are present before deployment
  6. 6.Deploy the metadata file using the platform-metadata-deploy skill or sf metadata deploy command
  7. 7.For delete: use destructiveChanges.xml to remove the subscription file and deploy the destructive change

Use cases

Good for
  • Subscribe a managed application to a platform event channel with durable replay tracking
  • Update replay strategy on an existing subscription without recreating it
  • Deactivate a subscription temporarily by changing state from RUN to STOP
  • Delete a subscription and remove its replay state via destructive metadata deployment
  • Query subscription metadata via Tooling API to retrieve the Id for Pub/Sub API ManagedSubscribe calls
Who it's for
  • Salesforce integration developers managing event-driven architectures
  • Platform event subscribers needing durable, replay-enabled subscriptions
  • Metadata-driven deployment automation for event subscription configuration
  • Developers building managed packages with event subscription dependencies

integration-eventing-subscription-configure FAQ

What is the difference between defaultReplay and errorRecoveryReplay?

defaultReplay determines where the subscription starts reading events when first activated (LATEST = newest events only, EARLIEST = all stored events). errorRecoveryReplay controls where replay resumes after a connection failure or error (LATEST = skip to current, EARLIEST = resume from last position). Both must be LATEST or EARLIEST.

Can I change the topicName or DeveloperName after creating a subscription?

No. topicName and DeveloperName are immutable after creation. If you need to change either, you must delete the subscription and create a new one—but this discards stored replay state.

Why does my subscription show INVALID_INPUT when I use PAUSE state?

PAUSE is reserved for internal Salesforce platform use only. You must use RUN (active) or STOP (inactive) as the state value.

How do I use a ManagedEventSubscription with the Pub/Sub API?

After deployment, retrieve the subscription's Id via Tooling API query: SELECT Id, DeveloperName FROM ManagedEventSubscription WHERE DeveloperName='<YourName>'. Pass either the DeveloperName or Id to the ManagedSubscribe RPC call.

What happens if I delete and recreate a subscription with the same DeveloperName?

The new subscription starts fresh from the defaultReplay position; all stored replay state from the deleted subscription is lost. Avoid reusing the same DeveloperName immediately after deletion.

Full instructions (SKILL.md)

Source of truth, from forcedotcom/sf-skills.


name: integration-eventing-subscription-configure description: "Create, read, update, and delete ManagedEventSubscription metadata in Salesforce. Use this skill for any work involving managed event subscriptions, platform event subscriptions, event channel subscribers, or .managedEventSubscription-meta.xml files. TRIGGER when: user asks to subscribe to a platform event, create a managed subscription, set up event replay, configure an event channel subscriber, update replay preset, activate or deactivate a subscription, delete a subscription, or manage ManagedEventSubscription metadata. SKIP when: user needs to create the platform event channel itself (use platform-custom-object-generate skill) or needs Flow-based event subscriptions (use automation-flow-generate skill)." metadata: version: "1.0" domains: ["Integration"] minApiVersion: "60.0" relatedSkills: - "automation-flow-generate" - "platform-custom-object-generate" - "platform-metadata-deploy" cliTools: - tool: ["sf"] semver: ">=2.0.0"

Managing ManagedEventSubscription

Create, read, update, and delete ManagedEventSubscription metadata — the Salesforce construct for durably subscribing to platform event channels with managed replay tracking.

Scope

  • In scope: Generating and modifying .managedEventSubscription-meta.xml files for create, read, update, and delete operations
  • Out of scope: Creating the underlying platform event (__e) channel itself; Flow-based or Apex-based event subscriptions; deploying metadata to an org
  • Only generate one file — the .managedEventSubscription-meta.xml file. Do NOT generate the referenced platform event object or any other metadata type.

Clarifying Questions

Before generating, confirm if not already clear:

  • What is the topic name? (see format table in references/topic-name-formats.md)
  • What is the developer name? (required for Create — alphanumeric and underscores only, no spaces; optional for Read/Update/Delete if Id is known)
  • What is the label (human-readable name)?
  • What default replay preset — LATEST (default) or EARLIEST?
  • What error recovery replay preset — LATEST (default) or EARLIEST?
  • What should the initial state be — RUN (active) or STOP (inactive)? (default: RUN)

Required Inputs

Gather or infer before proceeding:

  • Operation: create, read, update, or delete
  • DeveloperName: required for Create (becomes the filename); optional for Read/Update/Delete if Id is provided instead
  • Id: Tooling API record Id — can be used to identify the subscription for Read/Update/Delete instead of DeveloperName
  • label: human-readable label (can include spaces)
  • topicName: event channel path — read references/topic-name-formats.md for valid formats (platform events, change events, custom channels)
  • defaultReplay: LATEST or EARLIEST (default: LATEST)
  • errorRecoveryReplay: LATEST or EARLIEST (default: LATEST)
  • state: RUN or STOP (default: RUN) — PAUSE is reserved for internal platform use and will be rejected with INVALID_INPUT
  • version: Metadata API version (default: match org API version, e.g. 67.0)

Workflow

Create

  1. Gather inputs — confirm DeveloperName, label, topicName, defaultReplay, errorRecoveryReplay, state, version. Apply defaults for any omitted fields. If DeveloperName is not provided, ask the user — do not derive it from the label.
  2. Confirm the topic exists — ask the user to confirm the event channel already exists in the org before proceeding. Do NOT generate the platform event object yourself — that is out of scope for this skill. If the user says it doesn't exist yet, stop and direct them to create it first using the platform-custom-object-generate skill, then return here.
  3. Read the template — load assets/managed-event-subscription-template.xml as the starting structure.
  4. Generate the file — produce managedEventSubscriptions/<DeveloperName>.managedEventSubscription-meta.xml filled with user-provided values.
  5. Verify — run the checklist below before presenting output.
  6. Guide the user on subscribing — after deployment, the subscription can be identified for Pub/Sub API ManagedSubscribe RPC calls using either the DeveloperName or the record Id. To retrieve the Id, run: SELECT Id, DeveloperName FROM ManagedEventSubscription WHERE DeveloperName='<DeveloperName>' via the Tooling API.

Read

  1. Identify the subscription — accept either Id or DeveloperName; prefer Id if provided.
  2. Show the file path — managedEventSubscriptions/<DeveloperName>.managedEventSubscription-meta.xml (if DeveloperName known).
  3. Retrieve and display — read and present the current XML content.

Update

  1. Identify the subscription — accept either Id or DeveloperName; prefer Id if provided.
  2. Read the existing file — load current content before modifying.
  3. Apply changes — update only the specified fields; preserve all others.
  4. Read references/update-constraints.md for fields that cannot be changed after creation.
  5. Verify — run the checklist below before presenting output.

Delete

  1. Identify the subscription — accept either Id or DeveloperName; confirm with the user before proceeding.
  2. Warn — deleting a ManagedEventSubscription permanently removes replay tracking state.
  3. Produce deletion instructions — explain how to remove the file and deploy the destructive change using destructiveChanges.xml.
  4. Read references/delete-guide.md for the destructive deployment procedure.

Rules / Constraints

ConstraintRationale
<topicName> must use a valid path prefixPlatform events use /event/Name__e; change events use /data/Name; see references/topic-name-formats.md for all formats
<defaultReplay> and <errorRecoveryReplay> must be LATEST or EARLIESTThese are the only valid enum values; any other value fails metadata validation
<state> must be RUN or STOPPAUSE is reserved for internal platform use — the API rejects it with INVALID_INPUT: You can create a managed event subscription state field only to RUN or STOP
All six required elements must be presenttopicName, defaultReplay, errorRecoveryReplay, label, state, version are all required; omitting any causes a deploy error
DeveloperName must be unique within the orgDuplicate names cause DUPLICATE_DEVELOPER_NAME errors
Do not include <namespacePrefix>, <id>, or <createdDate>Read-only platform fields; including them causes deployment failures in unpackaged orgs

Gotchas

IssueResolution
The topicName field is invalid on deployWrong format or the event doesn't exist in the org — read references/topic-name-formats.md for correct path
Replay state lost after delete + recreateDeleting discards stored replay position; recreating starts from defaultReplay — avoid reusing the same DeveloperName after delete
INVALID_TYPE on SOQL queryManagedEventSubscription is only queryable via Tooling API, not standard SOQL
EARLIEST replay on high-volume channelsCan trigger up to 72 hours of backlog replay on activation; always confirm with the user
Metadata not supported in older orgsManagedEventSubscription requires API v60.0+; check org API version
eventChannel or isActive in generated XMLThese are wrong field names — use topicName and state (RUN/STOP) instead
PAUSE state in generated XMLPAUSE is reserved for internal platform use and will be rejected with INVALID_INPUT — only use RUN or STOP
User unsure how to identify subscription for Pub/Sub APIBoth DeveloperName and record Id can be used with ManagedSubscribe RPC — retrieve the Id via Tooling API if needed: SELECT Id FROM ManagedEventSubscription WHERE DeveloperName='<name>'
Changes not reflected immediately in Pub/Sub APIAfter create/update/delete, the Pub/Sub API can take up to ~2 minutes to reflect the new config; if ManagedSubscribe returns NOT_FOUND, wait and retry

Verification Checklist

Before presenting any generated XML:

  • Does <topicName> follow a valid path format per references/topic-name-formats.md? (/event/Name__e, /data/NameChangeEvent, /data/ChangeEvents, /event/Name__chn, /data/Name__chn)
  • Is <defaultReplay> exactly LATEST or EARLIEST?
  • Is <errorRecoveryReplay> exactly LATEST or EARLIEST?
  • Is <state> exactly RUN or STOP? (PAUSE is invalid for user-created subscriptions)
  • Is <label> populated?
  • Is <version> present (e.g. 67.0)?
  • Are read-only fields (<id>, <createdDate>, <namespacePrefix>) absent?
  • Does the filename match the DeveloperName exactly?

Output Expectations

  • Create / Update: managedEventSubscriptions/<DeveloperName>.managedEventSubscription-meta.xml — this is the only file to generate
  • Delete: instructions to remove the file and deploy via destructiveChanges.xml
  • Read: display of existing file contents

Cross-Skill Integration

NeedDelegate to
Create the platform event channel (__e) being subscribed toplatform-custom-object-generate skill
Subscribe via Flow (Process Automation)automation-flow-generate skill
Deploy metadata to orgplatform-metadata-deploy skill

Reference File Index

FileWhen to read
assets/managed-event-subscription-template.xmlBefore generating any new subscription — use as starting structure
references/topic-name-formats.mdWhen setting <topicName> — covers platform events, change events, and custom channels
references/update-constraints.mdDuring Update workflow — to check which fields are immutable post-creation
references/delete-guide.mdDuring Delete workflow — for destructive change deployment procedure

Related skills

More from forcedotcom/sf-skills and the wider catalog.

INinvestigating-agentforce-architecture logo

investigating-agentforce-architecture

forcedotcom/sf-skills

Declared architecture snapshot for one Agentforce agent: planner, topics, actions, flows, Apex, prompt templates, and NGA plugins. Renders a human-readable architecture document and Mermaid invocation graph from design-time metadata (not runtime audit rows). TRIGGER when user asks to describe, diagram, inventory, audit, document, or diff (e.g. v3 vs v5) the architecture / action tree / topic structure / tool inventory of a specific agent by agent API name in a specific org. DO NOT TRIGGER for runtime session traces, conversation transcripts, generation timings, or gateway audit chains — this skill reads design-time metadata only (use investigating-agentforce-d360 for session traces).

836 installs
INinvestigating-agentforce-d360 logo

investigating-agentforce-d360

forcedotcom/sf-skills

Data Cloud 360° view of a single Agentforce session. TRIGGER when user asks to trace, inspect, summarize, or describe a specific Agentforce session by session id (Agent Session UUID `019d…` or MessagingSession id `0Mw…`). Also triggers on session discovery — find/list/search sessions by time, agent, channel, outcome, or conversation text — when the user has no session id yet. DO NOT TRIGGER for design-time architecture questions (use investigating-agentforce-architecture instead) or for runtime perf/latency/SLO questions that require platform telemetry beyond Data Cloud.

822 installs
MAmanaging-managed-event-subscription logo

managing-managed-event-subscription

forcedotcom/sf-skills

Create, read, update, and delete ManagedEventSubscription metadata in Salesforce. Use this skill for any work involving managed event subscriptions, platform event subscriptions, event channel subscribers, or .managedEventSubscription-meta.xml files. TRIGGER when: user asks to subscribe to a platform event, create a managed subscription, set up event replay, configure an event channel subscriber, update replay preset, activate or deactivate a subscription, delete a subscription, or manage ManagedEventSubscription metadata. SKIP when: user needs to create the platform event channel itself (use generating-platform-event skill) or needs Flow-based event subscriptions (use generating-flow skill).

820 installsAudited
MOmobile-apps-create logo

mobile-apps-create

forcedotcom/sf-skills

Route Salesforce mobile app projects to the right SDK: Mobile SDK for data-driven apps, Agentforce SDK for agent-first experiences.

4.7k installs
MOmobile-platform-native-capabilities-integrate logo

mobile-platform-native-capabilities-integrate

forcedotcom/sf-skills

Integrate native mobile device capabilities (barcode, biometrics, location, NFC, payments) into Salesforce LWCs.

4.7k installs
MOmobile-platform-offline-validate logo

mobile-platform-offline-validate

forcedotcom/sf-skills

Static analyzer for Lightning Web Component mobile offline compatibility and Komaci priming validation.

4.7k installsAudited