Webhooks Postman Collection
One way to get started or refine requests is to use the BigCommerce Webhooks Postman collection, which contains core mutations and queries. To work with the Postman collection, you need to supply the following:
- The sandbox store’s
store_hash. - The sandbox store’s
access_token, which is available in one of the following ways:- For store-level API accounts, the access token is created automatically when you create the API account. To learn more, see Store-level API credentials in our Guide to API Accounts.
- For app-level API accounts, a store-specific access token is available in your app’s database as soon as you successfully install the app. You can also add a console log to get it from the terminal after the app completes the auth callback. For more about app-level API account, see App-level API accounts in our Guide to API Accounts.
Importing the collection
The following code block is an exported Postman collection of Webhooks mutations and queries. To copy the collection, hover over the upper right corner of the code block and click the Copy icon that appears.
For instructions on importing collections into Postman, see their article on Importing and Exporting Data (Postman).
Webhooks Postman collection
{ "info": { "_postman_id": "8eb8f3f2-529f-48cd-ab36-4fecd6fb3203", "name": "Demo Starter | GraphQL Admin API - Webhooks", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", "_exporter_id": "18324300" }, "item": [ { "name": "Create a GCP webhook", "event": [ { "listen": "test", "script": { "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Accept", "value": "application/json" }, { "key": "Content-Type", "value": "application/json" }, { "key": "X-Auth-Token", "value": "{{token}}" }, { "key": "Accept-Encoding", "value": "application/gzip", "type": "text" } ], "body": { "mode": "graphql", "graphql": { "query": "mutation CreatePubSubWebhook($input:CreatePubSubWebhookInput!) {\n webhook {\n createPubSubWebhook(input: $input) {\n webhook {\n id\n scope\n destination\n status\n createdAt\n }\n }\n }\n}", "variables": "{\n \"input\": {\n \t\"scope\": \"store/customer/created\",\n \t\"destination\": \"projects/gcp-pubsub-webhooks-demo/topics/bc-demo~store_customer_created\"\n }\n}" } }, "url": { "raw": "https://api.bigcommerce.com/stores/{{store_hash}}/graphql", "protocol": "https", "host": [ "api", "bigcommerce", "com" ], "path": [ "stores", "{{store_hash}}", "graphql" ], "query": [ { "key": "Accept-Encoding", "value": "gzip", "disabled": true } ] } }, "response": [ { "name": "Create a GCP webhook", "originalRequest": { "method": "POST", "header": [ { "key": "Accept", "value": "application/json" }, { "key": "Content-Type", "value": "application/json" }, { "key": "X-Auth-Token", "value": "{{token}}" }, { "key": "Accept-Encoding", "value": "application/gzip", "type": "text" } ], "body": { "mode": "graphql" }, "url": { "raw": "https://api.bigcommerce.com/stores/{{store_hash}}/graphql", "protocol": "https", "host": [ "api", "bigcommerce", "com" ], "path": [ "stores", "{{store_hash}}", "graphql" ], "query": [ { "key": "Accept-Encoding", "value": "gzip", "disabled": true } ] } }, "status": "OK", "code": 200, "_postman_previewlanguage": "json", "header": [ { "key": "Content-Type", "value": "application/json" }, { "key": "Transfer-Encoding", "value": "chunked" }, { "key": "Connection", "value": "keep-alive" }, { "key": "Vary", "value": "Accept-Encoding" }, { "key": "x-rate-limit-requests-left", "value": "16101494" }, { "key": "x-rate-limit-time-reset-ms", "value": "29998" }, { "key": "x-rate-limit-requests-quota", "value": "16101495" }, { "key": "x-rate-limit-time-window-ms", "value": "30000" }, { "key": "X-Request-ID", "value": "9dc4b62d5d12d996648944a4205a49ab" }, { "key": "Strict-Transport-Security", "value": "max-age=31536000; includeSubDomains" } ], "cookie": [], "body": "{\n \"data\": {\n \"webhook\": {\n \"createGcpPubSubWebhook\": {\n \"webhook\": {\n \"id\": \"bc/store/webhook/26066947\",\n \"scope\": \"store/customer/*\",\n \"destination\": \"projects/gcp-pubsub-webhooks-demo/topics/bc-demo~store_customer_created\",\n \"isActive\": true,\n \"createdAt\": \"2023-04-13T20:01:37Z\",\n \"attributes\": []\n }\n }\n }\n }\n}" } ] }, { "name": "Create a HTTP webhook", "event": [ { "listen": "test", "script": { "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Accept", "value": "application/json" }, { "key": "Content-Type", "value": "application/json" }, { "key": "X-Auth-Token", "value": "{{token}}" }, { "key": "Accept-Encoding", "value": "application/gzip", "type": "text" } ], "body": { "mode": "graphql", "graphql": { "query": "mutation CreateHTTPWebhook($input:CreateHttpsWebhookInput!) {\n webhook {\n createHttpsWebhook(input: $input) {\n webhook {\n destination\n status\n id\n scope\n createdAt\n headers {\n key\n value\n }\n \n }\n }\n}\n}", "variables": "{\n \"input\": {\n \"scope\": \"store/order/updated\",\n \t\"destination\": \"https://webhook.site/607d5ab5-6475-4ee8-9bb4-30b490436f49\",\n \"headers\": [\n {\n \"key\": \"My-Custom-Header\",\n \"value\": \"My custom header value\"\n }\n ]\n }\n \n}" } }, "url": { "raw": "https://api.bigcommerce.com/stores/{{store_hash}}/graphql", "protocol": "https", "host": [ "api", "bigcommerce", "com" ], "path": [ "stores", "{{store_hash}}", "graphql" ], "query": [ { "key": "Accept-Encoding", "value": "gzip", "disabled": true } ] } }, "response": [] }, { "name": "Get All Webhooks", "event": [ { "listen": "test", "script": { "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Accept", "value": "application/json" }, { "key": "Content-Type", "value": "application/json" }, { "key": "X-Auth-Token", "value": "{{token}}" }, { "key": "Accept-Encoding", "value": "application/gzip", "type": "text" } ], "body": { "mode": "graphql", "graphql": { "query": "query getAllHooks($cursor: String) {\n \n store {\n webhooks (first: 50, after: $cursor) {\n pageInfo {\n startCursor\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n id\n scope\n status\n ... on HttpsWebhook {\n destination\n }\n ... on PubSubWebhook {\n destination\n }\n createdAt\n updatedAt\n }\n }\n }\n }\n}", "variables": "" } }, "url": { "raw": "https://api.bigcommerce.com/stores/{{store_hash}}/graphql", "protocol": "https", "host": [ "api", "bigcommerce", "com" ], "path": [ "stores", "{{store_hash}}", "graphql" ], "query": [ { "key": "Accept-Encoding", "value": "gzip", "disabled": true } ] } }, "response": [] }, { "name": "Update GCP webhook: Deactivate the webhook", "event": [ { "listen": "test", "script": { "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Accept", "value": "application/json" }, { "key": "Content-Type", "value": "application/json" }, { "key": "X-Auth-Token", "value": "{{token}}" }, { "key": "Accept-Encoding", "value": "application/gzip", "type": "text" } ], "body": { "mode": "graphql", "graphql": { "query": "mutation UpdateWebhook($input:UpdatePubSubWebhookInput!) {\n webhook {\n updatePubSubWebhook(input: $input) {\n webhook {\n id\n status\n }\n }\n }\n}", "variables": "{\n \"input\": {\n \"data\": {\n \"isActive\": false\n },\n \"id\": \"bc/store/webhook/27069041\"\n }\n}" } }, "url": { "raw": "https://api.bigcommerce.com/stores/{{store_hash}}/graphql", "protocol": "https", "host": [ "api", "bigcommerce", "com" ], "path": [ "stores", "{{store_hash}}", "graphql" ], "query": [ { "key": "Accept-Encoding", "value": "gzip", "disabled": true } ] } }, "response": [] }, { "name": "Delete Webhook", "event": [ { "listen": "test", "script": { "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Accept", "value": "application/json" }, { "key": "Content-Type", "value": "application/json" }, { "key": "X-Auth-Token", "value": "{{token}}" }, { "key": "Accept-Encoding", "value": "application/gzip", "type": "text" } ], "body": { "mode": "graphql", "graphql": { "query": "mutation DeleteWebhook {\n webhook {\n deleteWebhook(id: \"bc/store/webhook/25765861\") {\n id\n }\n }\n}", "variables": "" } }, "url": { "raw": "https://api.bigcommerce.com/stores/{{store_hash}}/graphql", "protocol": "https", "host": [ "api", "bigcommerce", "com" ], "path": [ "stores", "{{store_hash}}", "graphql" ], "query": [ { "key": "Accept-Encoding", "value": "gzip", "disabled": true } ] } }, "response": [] } ] }