--- name: jpm-notifications description: "Implement and manage J.P. Morgan Payments Notifications (webhook) integrations in a merchant project once OAuth authentication is in place. Use this skill after jpm-oauth when the merchant wants to discover notification types, build a webhook receiver, create or inspect notification subscriptions, configure webhook security preferences, test delivery, retrieve notifications, or verify webhook signatures (X-Signature). Reuses the auth module generated by jpm-oauth — it does not implement its own OAuth. Delivery is WEBHOOK-first. Triggers include notifications, webhook, subscribe to notifications, notification types, callback URL, X-Signature, public keys, verify signature, payout/dispute/payment notifications, retry, dead letter." metadata: version: 1.0.0 --- # JPM Payments Notifications Guide a merchant through integrating J.P. Morgan Payments **Notifications** — real-time, asynchronous webhook callbacks about events they subscribe to (payouts, disputes, payment updates, refunds, and more). Authentication is assumed to be in place; this skill reuses the `getAccessToken()` auth module produced by the `jpm-oauth` skill and never re-implements OAuth. ## Disclaimer (show before doing any work) Show this verbatim and wait for acknowledgment: > **Disclaimer:** We do not assume any responsibility for any issues, damages, or losses that > may arise from using the code generated or modified by this skill. These skills rely on AI > agents to produce code, and all generated code should be carefully reviewed and verified by a > qualified engineer before being deployed to a production environment. Use `AskUserQuestion`: - Question: "Do you acknowledge the disclaimer above and want to proceed?" - Header: "Acknowledge" - Options: "Yes — proceed" / "No — exit" If **No**, exit. ## Prerequisite A — Auth via `jpm-oauth` The merchant needs a working auth module that exposes `getAccessToken()` (or its language equivalent), produced by the `jpm-oauth` skill. Every Notifications API call uses `Authorization: Bearer ` from that module. - If you arrived here from `jpm-oauth`, the auth module path is already in conversation context — use it. - If invoked standalone, ask: - Question: "Is JPM OAuth already wired up in this project (a working `getAccessToken()`)?" - Header: "Auth ready?" - Options: "Yes — I have it" / "No — not yet" - If **No**: tell the user to run `jpm-integrations-get-started` first (it hands off to `jpm-oauth`), then return here. Exit. - If **Yes** but the module path isn't known, ask where it lives so generated code can import it. Do **not** collect or persist credentials here. The auth module already reads them from `.env`. ## Prerequisite B — LIVE-DOC policy (PDP documentation) Before using any contract detail (notification types, subscription fields, security preferences, public keys, webhook verification, testing scenarios, retrieve), **attempt a live fetch of the relevant PDP page first**. This is a hard requirement, not a suggestion. **How to fetch:** Attempt a live fetch of the canonical URL using whatever web/HTTP tool your harness provides. If the fetch fails or the domain is unreachable, **stop immediately** — inform the merchant that `developer.payments.jpmorgan.com` must be allowlisted on their network before continuing. Do not proceed with assumed or cached contract details. Running a live API call (curl) does NOT count as the LIVE-DOC step — they are separate actions. **Inline canonical URLs (use these directly — no manifest lookup needed):** > The agent's network must be able to reach `developer.payments.jpmorgan.com`. There is no offline > fallback. If the domain is blocked, ask the merchant to allowlist it before continuing. | Topic | Canonical URL | | ----- | ------------- | | Notification types | [Notification types](https://developer.payments.jpmorgan.com/api/llm-content?path=en%2Fdocs%2Fcommerce%2Foptimization-protection%2Fcapabilities%2Fnotifications%2Fnotification-types.md) | | Subscribe / subscription fields | [Subscribe to notifications](https://developer.payments.jpmorgan.com/api/llm-content?path=en%2Fdocs%2Fcommerce%2Foptimization-protection%2Fcapabilities%2Fnotifications%2Fhow-to%2Fsubscribe-to-notifications.md) | | Security preferences | [Security preferences](https://developer.payments.jpmorgan.com/api/llm-content?path=en%2Fdocs%2Fcommerce%2Foptimization-protection%2Fcapabilities%2Fnotifications%2Fsecurity-preferences.md) | | Webhook verification | [Webhook verification](https://developer.payments.jpmorgan.com/api/llm-content?path=en%2Fdocs%2Fcommerce%2Foptimization-protection%2Fcapabilities%2Fnotifications%2Fwebhook-verification.md) | | Public keys | [Public keys](https://developer.payments.jpmorgan.com/api/llm-content?path=en%2Fdocs%2Fcommerce%2Foptimization-protection%2Fcapabilities%2Fnotifications%2Fpublic-keys.md) | | Testing | [Testing](https://developer.payments.jpmorgan.com/api/llm-content?path=en%2Fdocs%2Fcommerce%2Foptimization-protection%2Fcapabilities%2Fnotifications%2Ftesting.md) | | Retrieve notifications | [Retrieve notifications](https://developer.payments.jpmorgan.com/api/llm-content?path=en%2Fdocs%2Fcommerce%2Foptimization-protection%2Fcapabilities%2Fnotifications%2Fhow-to%2Fretrieve-notifications.md) | **Reconciliation:** After each successful live fetch, output a one-line summary: either "Live fetch successful — content loaded" or "Live fetch failed: [exact error] — merchant must allow `developer.payments.jpmorgan.com`". ## Prerequisite C — LIVE-API policy (making runtime API calls) > This is distinct from Prerequisite B. LIVE-DOC = fetching PDP documentation pages. > LIVE-API = calling the Notifications service API (subscriptions, notifications, etc.). This skill does not run a server and ships no Python to execute. API calls happen in one of two ways — pick per the merchant's intent: - **Manual or exploratory calls**: execute [templates/notifications.http](templates/notifications.http) in a supported HTTP client, or issue a terminal request from [templates/curl-examples.md](templates/curl-examples.md). - **Production behavior**: generate merchant-native code that calls the API using `getAccessToken()` — a subscription client and/or a webhook receiver. See [references/webhook-handler.md](references/webhook-handler.md). **Ready-to-run requests (Bruno):** the supported subscription requests live in the [Notifications Bruno collection](https://github.com/jpmorgan-payments/api-collections/tree/main/merchant-services/Notifications), folder `merchant-services/Notifications/`: - `Subscribe to a notification.bru` - `Get all subscriptions by entity Id.bru` - `Get a subscription by subscription Id.bru` - `Update a specific subscription.bru` - `Delete a specific subscription.bru` - `Get all notification event types available.bru` - `Get a public key by entity Id.bru` - `Health check for the Notification Subscription service.bru` Treat the collection as the canonical, more-frequently-updated reference for covered request bodies, headers, and responses. Use it to learn or update the request shape, then execute the actual call through the local HTTP or terminal templates. Configure those requests with the CAT base URL and a token returned by the merchant's `jpm-oauth` module. Never print full tokens back to the user. Operations not listed above are documented in [references/api-and-types.md](references/api-and-types.md). ## Prerequisite D — CAT Environment All merchant integrations target the **CAT environment** exclusively. Base URL: `https://mns-aws-cat.jpmchase.com`. Use this base URL for **all live API calls in this session**. > The generated code (receiver, subscription client, signature verification) must be written to work > across environments by externalization — only the host changes. You configure the host at > deployment time. Then start the journey at Phase 1. The full path is: 1. **Discover & choose** notification types → Phase 1 2. **Build** the webhook receiver for the chosen types → Phase 2 3. **Subscribe** for the chosen types → Phase 3 4. **Test** delivery end-to-end → Phase 4 5. **Go live** checklist → Phase 5 Work through each phase in order. At the end of each phase, offer to continue to the next — but if the merchant says a phase is already done, skip it. ## Phase 1 — Discover and choose notification types > **LIVE-DOC required.** Refer to the [Notification types](https://developer.payments.jpmorgan.com/api/llm-content?path=en%2Fdocs%2Fcommerce%2Foptimization-protection%2Fcapabilities%2Fnotifications%2Fnotification-types.md) documentation. > If blocked, stop and inform the merchant: outbound access to `developer.payments.jpmorgan.com` > must be allowed before continuing. Output a one-line fetch status before proceeding. From the content (live or bundled), extract and present only the **WEBHOOK-deliverable** types — omit any type or sub-type that is webhook-only at a per-sub-type level; omit non-webhook-only types entirely. Present as a compact table; do not dump raw JSON. **The merchant must explicitly choose** which types (and sub-types) they want to subscribe to. After presenting the table, ask in plain text: > "Which notification types would you like to subscribe to, and which sub-types for each? For example: payoutNotification — All, or paymentUpdateNotification — PaymentApproved, PaymentDeclined. You can name as many as you like." Wait for the merchant's free-text reply. Confirm back the selected types and sub-types, then ask: "Does this look right?" If they correct it, update and confirm again. Once confirmed, carry `chosen_types` through the rest of the journey. Once the merchant has confirmed their chosen types, ask: - Question: "Got it — I'll use these types in both the receiver and the subscription. Ready to build the webhook handler?" - Header: "Next: Phase 2 — Build receiver" - Options: "Yes — build the receiver now" / "I'm done for now" ## Phase 2 — Build a webhook receiver > **LIVE-DOC required before generating code.** Refer to the [Public keys](https://developer.payments.jpmorgan.com/api/llm-content?path=en%2Fdocs%2Fcommerce%2Foptimization-protection%2Fcapabilities%2Fnotifications%2Fpublic-keys.md) documentation. > If blocked, stop and inform the merchant: `developer.payments.jpmorgan.com` must be reachable. > Output fetch status. Then read [references/webhook-handler.md](references/webhook-handler.md) for the guardrails. Do not write any file until the merchant has explicitly approved the full plan. Use this sequence: 1. **Read the application code.** Before proposing anything: - Language, framework, routing/middleware, the `jpm-oauth` auth module, queue/DB, logging, and config/secrets conventions. - How existing routes/endpoints are declared in the application code. - Understand patterns so the new webhook handler follows the same style. 2. **Present the application change list:** - *Handler / service code* — webhook entry point, signature verification, event routing to `chosen_types`, dedup, queue/async, status codes, logging. - *Routing / framework registration* — any file where the new webhook route must be declared. - *Config / env vars* — any new environment variable, feature flag, or config key needed. For each entry: exact file path, what changes and why — outline only, no full code yet. 3. **Single approval for the application change plan.** Use `AskUserQuestion`: - Question: "This is the full set of application code changes. Shall I go ahead and build it?" - Header: "Approve the plan" - Options: "Yes — build it" / "No — let's adjust first" 4. **Discuss if needed.** Update the plan based on feedback, then ask for approval again. 5. **Implement all changes after approval.** Write every file from the approved change list. Implement every guardrail from [references/webhook-handler.md](references/webhook-handler.md). The handler must cover the exact `chosen_types` selected in Phase 1. 6. **Post-write verification pass.** After all files are written, re-read every modified file and cross-check against the approved plan: - Does the handler follow the same patterns as existing code in the project? - Are all routes properly declared in the framework? - Are all env vars declared and consistent? Output: "Verification complete — all [N] changes implemented and consistent with existing patterns." If any gap is found, fix it immediately before reporting done. Once the receiver code is written and the merchant confirms they're happy with it, ask in plain text: > "The webhook receiver code is ready. Now you'll need to ensure your infrastructure can receive incoming webhooks from JPM — DNS, firewall rules, TLS certificate, and any network configuration to allow inbound HTTPS traffic. Once your endpoint is deployed and publicly reachable, we can proceed to create the subscription." Wait for them to confirm deployment is done and the endpoint is publicly reachable. Only after the merchant confirms the endpoint is deployed and reachable, ask: - Question: "Great — endpoint is live. Ready to create the subscription so JPM can start delivering notifications to it?" - Header: "Next: Phase 3 — Create subscription" - Options: "Yes — create the subscription now" / "I'm done for now" ## Phase 3 — Create / manage a subscription > **LIVE-DOC required.** Refer to the following documentation before collecting any subscription > fields or security preferences: > 1. [Subscribe to notifications](https://developer.payments.jpmorgan.com/api/llm-content?path=en%2Fdocs%2Fcommerce%2Foptimization-protection%2Fcapabilities%2Fnotifications%2Fhow-to%2Fsubscribe-to-notifications.md) > 2. [Security preferences](https://developer.payments.jpmorgan.com/api/llm-content?path=en%2Fdocs%2Fcommerce%2Foptimization-protection%2Fcapabilities%2Fnotifications%2Fsecurity-preferences.md) > 3. [Webhook verification](https://developer.payments.jpmorgan.com/api/llm-content?path=en%2Fdocs%2Fcommerce%2Foptimization-protection%2Fcapabilities%2Fnotifications%2Fwebhook-verification.md) > If any fetch is blocked, stop and inform the merchant: `developer.payments.jpmorgan.com` must be > reachable. Output fetch status for each URL before proceeding. Follow [references/subscriptions-and-testing.md](references/subscriptions-and-testing.md). Use `chosen_types` from Phase 1 in the selected Bruno subscription request — do not ask the merchant to re-enter them. Collect only values that cannot be inferred from the merchant's project. **Notification types — confirm and extend.** Show the merchant their `chosen_types` from Phase 1, then ask in plain text: > "Would you like to add any more notification types before I create the subscription? If yes, just tell me which types and sub-types to add. If you're happy with the current list, say 'no' and we'll proceed." Wait for the reply. If they add more, merge them into `chosen_types`, show the updated list, and ask again until they confirm they are done. The final merged set goes into the `notifications` field. After confirming types, collect security preferences — ask one gate question: "Does your webhook require JPM to authenticate when calling it?" Use the matching Bruno security-preference example, and mask any secret as `****` when echoing back. **Preview the configured Bruno operation with secrets masked and get confirmation before any create/update/delete.** Confirm the completed operation using the relevant Bruno request and summarize the result. Once the subscription is `ACTIVATED`, ask: - Question: "Subscription is active. Ready to test end-to-end delivery to your webhook?" - Header: "Next: Phase 4 — Test delivery" - Options: "Yes — test it now" / "I'm done for now" ## Phase 4 — Test / debug delivery > **LIVE-DOC required.** Refer to the [Testing](https://developer.payments.jpmorgan.com/api/llm-content?path=en%2Fdocs%2Fcommerce%2Foptimization-protection%2Fcapabilities%2Fnotifications%2Ftesting.md) documentation. > If blocked, stop: `developer.payments.jpmorgan.com` must be reachable. Output fetch status. Follow [references/subscriptions-and-testing.md](references/subscriptions-and-testing.md). Help the merchant exercise their endpoint, interpret delivery failures, and explain the platform retry schedule using the reference markdown rather than duplicating PDP details here. Once testing passes, ask: - Question: "Testing looks good. Ready to run the go-live checklist?" - Header: "Next: Phase 5 — Go live" - Options: "Yes — run the checklist" / "I'm done for now" ## Phase 5 — Retrieve notifications / go-live > **LIVE-DOC required.** Refer to the [Retrieve notifications](https://developer.payments.jpmorgan.com/api/llm-content?path=en%2Fdocs%2Fcommerce%2Foptimization-protection%2Fcapabilities%2Fnotifications%2Fhow-to%2Fretrieve-notifications.md) documentation. > If blocked, stop: `developer.payments.jpmorgan.com` must be reachable. Output fetch status. Use [references/subscriptions-and-testing.md](references/subscriptions-and-testing.md) for missed/stored notification retrieval and the readiness checklist. Once the checklist is complete, confirm infrastructure readiness with the merchant: > "Before going live, please confirm: your firewall/security groups allow inbound HTTPS traffic to your webhook endpoint; your TLS certificate is valid for the callback domain; DNS is configured; and JPM can successfully reach and verify the endpoint. Once you've made these supporting infrastructure changes, we can close out the integration." Wait for the merchant to confirm all infrastructure changes are in place and JPM can reach the endpoint. Once confirmed, close out the session: - Summarise which phases were completed (types chosen, receiver written, subscription ID, test result, checklist status). - Remind the merchant: test in CAT; never commit tokens or secrets. - Ask: "Is there anything else you need help with?" and offer to loop back to any step if needed. ## Reference map (progressive disclosure — load on demand) - [references/api-and-types.md](references/api-and-types.md) — CAT base URL, auth guidance, and PDP links. - [references/webhook-handler.md](references/webhook-handler.md) — receiver guardrails, language-agnostic pseudocode, signature verification (X-Signature, EC/RSA), post-implementation checklist. - [references/subscriptions-and-testing.md](references/subscriptions-and-testing.md) — subscription workflow, verification lifecycle, testing, retry schedule, and go-live checklist. - [templates/notifications.http](templates/notifications.http), [templates/curl-examples.md](templates/curl-examples.md) — executable HTTP-client and terminal request templates. - [Notifications Bruno collection](https://github.com/jpmorgan-payments/api-collections/tree/main/merchant-services/Notifications) — supported API requests, headers, payloads, and responses. ## Rules - Reuse the `jpm-oauth` auth module for every call. Do **not** re-implement OAuth or fetch a token per request. - Delivery is **WEBHOOK-only**. Never present, offer, or generate any other delivery channel; if a live doc or API response lists other channels, omit them and show only webhook-deliverable types/sub-types. - Never hardcode the API host — read it from an env var (e.g. `JPM_NOTIFICATIONS_API_URL`). All environments share the same versioned `/v1/...` paths; only the host differs. Use the CAT base URL `https://mns-aws-cat.jpmchase.com` for all live API calls in this session. Generated code must be written to work across environment tiers by pointing to different hosts at deployment time. - Preview every create/update/delete request and get explicit confirmation before executing it. - Never print full access tokens, private keys, or client secrets. Mask secrets as `****`. - Confirm every output file path before writing generated code. - Generate code and infrastructure that fits the merchant's codebase. Before writing **any** file, read the full project — language, framework, routing/middleware, the `jpm-oauth` auth module, logging, queue/DB, config/secrets, IaC files, and security config — then produce **every** change (application code, IaC rules, security/auth registration) that matches existing patterns. Identify how the project wires up endpoints across all layers (routing, load-balancer rules, ingress, security chains, auth policies) and apply the same pattern to the webhook endpoint. Follow the pattern precisely; never apply a different style to new files. If no existing pattern exists, choose best practice for the stack. - Include IaC and security-registration changes in the same plan as application code — never treat them as a separate step or afterthought. All changes (code, infra, security config) are presented together, approved in one confirmation, and implemented in one pass. Call out any network-level changes the merchant must make outside IaC (firewall rules, TLS renewal, DNS updates, inbound IP allowlists) and add them to the change list before asking for approval. - Prefer live PDP docs; there is no offline fallback — `developer.payments.jpmorgan.com` must be reachable. If blocked, stop and ask the merchant to allowlist the domain. - **LIVE-DOC hard gate.** Before generating code or presenting any contract detail (payload shape, headers, verification, security preferences, retry policy, subscription fields), a fetch call MUST have been attempted for the relevant PDP page in this session using whatever URL-fetching tool the harness provides. Valid fallback reasons: network error, HTTP error, or explicit policy block — each must be stated with the specific error. Invalid skip reasons: "no tool available", "fetch not supported", or any equivalent blanket claim without a concrete error. Code or advice generated without an attempt (or with only an invalid skip reason) is a policy violation. Note: running a LIVE-API `curl` call does NOT satisfy this requirement — they are different actions. - Test in CAT.