# Make Scenario Trigger

## Objective

Send chosen app events into a Make scenario through a configurable webhook.

A per-workspace webhook destination pointing at a Make scenario, with event and field selection, delivery logs, and a pause on repeated failure.

## Before You Begin

This feature is being added to an application that already exists and already
works. Do not scaffold a new project, and do not assume a blank slate.

Inspect the codebase first and establish:

- The existing application structure and where code of this kind already lives.
- The framework and version in use.
- The existing design system — colours, spacing, typography, and component conventions.
- Existing UI components you can reuse instead of writing new ones.
- The existing database structure, if this feature needs to persist anything.
- The existing authentication and authorization system, if this feature is user-scoped.
- Dependencies already installed, so you don't add a library that duplicates one.
- The existing test setup and conventions.

Only start writing code once you understand the above. If the application
already implements part of this feature, extend it rather than replacing it.

## Implementation Instructions

1. Reuse the shared outbound delivery pipeline described in the Zapier Trigger Webhook brief. That brief owns queueing, signing, retry policy, and auto-disable; this one owns the Make-specific destination, its configuration screen, and the field selection.
2. Let the user choose both the event types and which fields of each event are included, and default the field set to the minimum rather than the whole record.
3. Encrypt the stored webhook URL at rest and mask it in the interface after it is saved, revealing it only on an explicit action by someone who may edit the integration.
4. Give every delivery attempt a row in a log the user can read: when it was sent, the response status, whether it will be retried, and the payload that was sent with secrets redacted.
5. Do not let the user edit an active field selection in a way that silently changes the shape of an already-running scenario. Version the payload shape and surface the version in both the payload and the settings screen.

## UI and UX Requirements

Match the application's existing design system exactly. Reuse its components,
spacing, and typography. This feature should look like it was always there.

## Responsive Requirements

Works on mobile, tablet, and desktop. Touch targets are large enough to hit on a
phone, and nothing overflows horizontally at 320px.

## Accessibility Requirements

- Fully keyboard navigable.
- Correct semantic elements and ARIA roles.
- Visible focus states.
- Meets WCAG AA contrast.
- Dynamic changes are announced to screen readers.
- Respects prefers-reduced-motion.

## Edge Cases

- A webhook URL is a bearer credential in disguise — anyone holding it can feed the scenario. Store it encrypted, never log it in plain text, never include it in error reports, and require HTTPS with an externally resolvable host.
- A scenario built against a fixed payload breaks the moment a field is added or renamed. Let the user pick the event types and fields explicitly, keep the shape versioned, and treat an unselected field as absent rather than null.
- Retries will deliver the same event twice, and Make will run the scenario twice. Include a delivery identifier that is stable across attempts so the scenario can discard a repeat instead of duplicating the work downstream.
- Users cannot debug what they cannot see. Provide a delivery log with attempt history and response status, plus a manual test action that sends a clearly marked sample so a new scenario can be validated before real events flow.
- An endpoint that keeps failing will otherwise accumulate a growing backlog of doomed retries. Pause delivery for that integration after a sustained run of failures, hold or discard the backlog by a stated rule, and notify the owner rather than failing silently.
- Make will rate limit a scenario that is fed too fast. Respect any throttling response, back off with jitter, and cap concurrent deliveries per integration.
- When Make itself is down, the user should see the integration marked as degraded with the last successful delivery time, not an app that appears broken or an action that refuses to complete.
- Delivery logs contain payloads, and payloads contain customer data. Apply a retention limit, redact fields marked sensitive, and scope log visibility to the workspace that owns the integration.

## Testing

Exercise the feature end to end in the running application. Cover every edge case
above, then run the existing test suite and confirm nothing regressed.

## Acceptance Criteria

- [ ] A workspace can configure a Make destination, select event types, and select payload fields.
- [ ] Stored webhook URLs are encrypted at rest and masked in the interface.
- [ ] Each delivery carries a stable identifier that is unchanged across retries.
- [ ] A readable delivery log records every attempt with its response status and outcome.
- [ ] A test action sends a clearly marked sample without entering the production event history.
- [ ] Sustained failures pause the integration and notify its owner.
- [ ] The delivery pipeline is shared with the other outbound webhook integrations rather than duplicated.
- [ ] The feature matches the existing design system.
- [ ] No existing functionality is broken.

## Adaptation Rules

- Match the existing design system. Do not introduce a new colour palette,
  spacing scale, or component library.
- Reuse existing components and utilities wherever they fit.
- Follow the naming, file layout, and code style already present.
- Do not upgrade, replace, or remove existing dependencies to make this
  feature fit. Adapt the feature to the app, not the app to the feature.
- Do not break existing functionality. If a change is genuinely required in
  existing code, make the smallest one that works and say so.
- If something in these instructions conflicts with how the application is
  built, follow the application and explain the deviation.

## Final Verification

Before you report the work as done:

1. Re-read the acceptance criteria above and check each one against what you
   actually built.
2. Run the application and exercise the feature end to end.
3. Run the existing test suite and confirm you have broken nothing.
4. Check the feature on mobile, tablet, and desktop widths.
5. Check keyboard navigation and focus handling.
6. Summarize what changed: files added, files modified, and anything you
   deliberately did differently because of how this application is built.

If any acceptance criterion is unmet, fix it before reporting completion.
