# BigCommerce webhooks to Amazon EventBridge (illustrative)

Context: companion to `/blog/amazon-connect-bigcommerce-integration-2026/`. No AWS or BigCommerce resource was created to write this. Nothing here was run against a live store; only the JSON file is tested (`node --test`).

## Files
- `rule-pattern.illustrative.json` - EventBridge rule pattern. It matches `detail-type` = `bigCommerceWebhook`, the only delivered-event field the BigCommerce EventBridge page documents.
- `rule.test.mjs` - 2 tests: the pattern is valid JSON with only that key, and this README keeps its "not verified" caveat.

## Order of operations (from the BigCommerce page and the AWS EventBridge SaaS page)
1. BigCommerce Admin GraphQL (`https://{zone}/stores/{store_hash}/graphql`, header `X-Auth-Token`): mutation `createEventSource` with `awsAccount`, `eventSourceName`, `eventSourceRegion` (for example `US_EAST_1`) and `clientId`. Keep the returned `arn` and `eventSourceName`.
2. AWS, same account and Region: associate the pending partner event source with an event bus (console "Associate with event bus", or `aws events create-event-bus --name <eventSourceName> --event-source-name <eventSourceName>`). Events sent before this step are dropped.
3. AWS: create a rule on that bus with the pattern file, and add a Lambda function (or SQS queue) as the target.
4. BigCommerce Admin GraphQL: mutation `createEventBridgeWebhook` with `destination` (the event source ARN), `isActive: true` and `scope` (for example `store/order/statusUpdated`).

## Not verified
- The JSON body of a delivered event (`source`, `detail` field names). The BigCommerce page shows only the `detail-type`. Log one real event in a staging store before you write a handler or narrow the pattern.
- Whether a store-level API account `clientId` is accepted by `createEventSource`, and which token scope the GraphQL mutations need. The page does not say.
