
Managed Event Subscription Manager
OfficialFreeEfficiently manage Salesforce event subscriptions.
Free · Opens the source repo
What Managed Event Subscription Manager does
The Managed Event Subscription Manager skill provides developers with the ability to create, read, update, and delete ManagedEventSubscription metadata within Salesforce. This skill is specifically designed for tasks related to managed event subscriptions, which are essential for subscribing to platform event channels with durable replay tracking. Users can generate and modify .managedEventSubscription-meta.xml files, making it easier to handle event-driven architectures in Salesforce.
When using this skill, developers will be guided through a structured workflow that ensures all necessary inputs are gathered and validated before any operations are performed. This includes confirming the existence of the topic name, specifying the developer name, and setting the desired replay states. The skill emphasizes the importance of adhering to Salesforce's metadata requirements, helping to avoid common pitfalls such as invalid topic names or missing required fields.
This tool is particularly useful for Salesforce developers who need to manage event subscriptions without the overhead of creating the underlying platform event channels themselves. It's ideal for teams working on integration projects that rely on real-time data processing and event-driven communication. By automating the generation of subscription metadata, developers can focus on building robust applications without getting bogged down by manual XML file management.
However, it is important to note that this skill does not support the creation of platform event channels or Flow-based event subscriptions. For those functionalities, users are directed to other skills within the ecosystem. The Managed Event Subscription Manager skill is best suited for users who are familiar with Salesforce's metadata API and are looking for a streamlined approach to managing event subscriptions.
When to use it
Use this skill when you need to create, update, or delete managed event subscriptions in Salesforce without creating the underlying platform events.
When not to use it
Avoid using this skill if you need to create platform event channels or require Flow-based event subscriptions; those tasks are outside its scope.
What you can build with it
Creating a New Subscription
Use this skill to define a new managed event subscription by providing necessary parameters like topic name and replay settings.
Updating an Existing Subscription
Modify the details of an existing managed event subscription while preserving other configurations.
Deleting a Subscription
Permanently remove a managed event subscription and understand the implications for replay tracking.
How to install Managed Event Subscription Manager
View source1. Install with the skills CLI
npx skills add forcedotcom/sf-skills/integration-eventing-subscription-configure --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by forcedotcomManaging 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.xmlfiles 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.xmlfile. 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
Idis known) - What is the label (human-readable name)?
- What default replay preset —
LATEST(default) orEARLIEST? - What error recovery replay preset —
LATEST(default) orEARLIEST? - What should the initial state be —
RUN(active) orSTOP(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
Idis 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.mdfor valid formats (platform events, change events, custom channels) - defaultReplay:
LATESTorEARLIEST(default:LATEST) - errorRecoveryReplay:
LATESTorEARLIEST(default:LATEST) - state:
RUNorSTOP(default:RUN) —PAUSEis reserved for internal platform use and will be rejected withINVALID_INPUT - version: Metadata API version (default: match org API version, e.g.
67.0)
Workflow
Create
- 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.
- 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-generateskill, then return here. - Read the template — load
assets/managed-event-subscription-template.xmlas the starting structure. - Generate the file — produce
managedEventSubscriptions/<DeveloperName>.managedEventSubscription-meta.xmlfilled with user-provided values. - Verify — run the checklist below before presenting output.
- Guide the user on subscribing — after deployment, the subscription can be identified for Pub/Sub API
ManagedSubscribeRPC calls using either theDeveloperNameor the recordId. To retrieve theId, run:SELECT Id, DeveloperName FROM ManagedEventSubscription WHERE DeveloperName='<DeveloperName>'via the Tooling API.
Read
- Identify the subscription — accept either
IdorDeveloperName; preferIdif provided. - Show the file path —
managedEventSubscriptions/<DeveloperName>.managedEventSubscription-meta.xml(if DeveloperName known). - Retrieve and display — read and present the current XML content.
Update
- Identify the subscription — accept either
IdorDeveloperName; preferIdif provided. - Read the existing file — load current content before modifying.
- Apply changes — update only the specified fields; preserve all others.
- Read
references/update-constraints.mdfor fields that cannot be changed after creation. - Verify — run the checklist below before presenting output.
Delete
- Identify the subscription — accept either
IdorDeveloperName; confirm with the user before proceeding. - Warn — deleting a ManagedEventSubscription permanently removes replay tracking state.
- Produce deletion instructions — explain how to remove the file and deploy the destructive change using
destructiveChanges.xml. - Read
references/delete-guide.mdfor the destructive deployment procedure.
Rules / Constraints
| Constraint | Rationale |
|---|---|
<topicName> must use a valid path prefix | Platform 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 EARLIEST | These are the only valid enum values; any other value fails metadata validation |
<state> must be RUN or STOP | PAUSE 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 present | topicName, defaultReplay, errorRecoveryReplay, label, state, version are all required; omitting any causes a deploy error |
| DeveloperName must be unique within the org | Duplicate 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
| Issue | Resolution |
|---|---|
The topicName field is invalid on deploy | Wrong format or the event doesn't exist in the org — read references/topic-name-formats.md for correct path |
| Replay state lost after delete + recreate | Deleting discards stored replay position; recreating starts from defaultReplay — avoid reusing the same DeveloperName after delete |
INVALID_TYPE on SOQL query | ManagedEventSubscription is only queryable via Tooling API, not standard SOQL |
EARLIEST replay on high-volume channels | Can trigger up to 72 hours of backlog replay on activation; always confirm with the user |
| Metadata not supported in older orgs | ManagedEventSubscription requires API v60.0+; check org API version |
eventChannel or isActive in generated XML | These are wrong field names — use topicName and state (RUN/STOP) instead |
PAUSE state in generated XML | PAUSE 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 API | Both 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 API | After 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 perreferences/topic-name-formats.md? (/event/Name__e,/data/NameChangeEvent,/data/ChangeEvents,/event/Name__chn,/data/Name__chn) - Is
<defaultReplay>exactlyLATESTorEARLIEST? - Is
<errorRecoveryReplay>exactlyLATESTorEARLIEST? - Is
<state>exactlyRUNorSTOP? (PAUSEis 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
| Need | Delegate to |
|---|---|
Create the platform event channel (__e) being subscribed to | platform-custom-object-generate skill |
| Subscribe via Flow (Process Automation) | automation-flow-generate skill |
| Deploy metadata to org | platform-metadata-deploy skill |
Reference File Index
| File | When to read |
|---|---|
assets/managed-event-subscription-template.xml | Before generating any new subscription — use as starting structure |
references/topic-name-formats.md | When setting <topicName> — covers platform events, change events, and custom channels |
references/update-constraints.md | During Update workflow — to check which fields are immutable post-creation |
references/delete-guide.md | During Delete workflow — for destructive change deployment procedure |
Frequently asked questions about Managed Event Subscription Manager
Similar skills
WinMD API Search
Easily find and explore Windows desktop APIs.
WebMCPify
Transform any web app into an agent-ready platform.
Phoenix Tracing
Instrument LLM applications with OpenInference tracing.
Foundry Hosted Agent CopilotKit
Guidance for developing agentic web apps on Azure.
Power Automate Foundation
Connect AI agents to Power Automate seamlessly.
Power Automate Flow Builder
Efficiently build and deploy Power Automate flows programmatically.
