-
Notifications
You must be signed in to change notification settings - Fork 56
DEVDOCS-6557 - Webhooks for B2B Events (Phase 1) #1173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
155fa70
DEVDOCS-6557 - Webhooks for B2B Events (Phase 1)
bc-Vince d1e8ad4
DEVDOCS-6557 - Webhooks for B2B Events (Phase 1)
bc-Vince edc84c1
Apply suggestions from code review
bc-Vince 0b6568c
DEVDOCS-6557 - Webhooks for B2B Events (Phase 1)
bc-Vince d46ba19
Merge branch 'main' into DEVDOCS-6557
bc-Vince f1ebce7
Apply suggestions from SME review
bc-Vince ff9ace4
Apply suggestions from code review
bc-Vince 442cfee
Merge branch 'main' into DEVDOCS-6557
bc-Vince a1c0ed9
Update docs/integrations/webhooks/events/b2b-edition.mdx
bc-Vince File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,147 @@ | ||
| --- | ||
| title: B2B Edition Webhooks | ||
| keywords: webhooks, b2b, b2b edition, company, super admin, address, company user, | ||
bc-Vince marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| --- | ||
|
|
||
| # B2B Edition Webhooks | ||
|
|
||
| B2B Edition is BigCommerce’s all-in-one solution that offers enterprise-level B2B functionality to businesses of all types and sizes. It enables business owners to facilitate their B2B operations online and to provide customers with self-service account capabilities and seamless transactions. | ||
|
|
||
| This page is a reference for B2B Edition webhooks and it assumes that you're familiar with webhooks. For a general introduction to webhooks, see [Webhooks Overview](/docs/integrations/webhooks). | ||
|
|
||
| **Note:** B2B Edition currently does not support storefront channel-specific webhooks. | ||
|
|
||
| ## Creating a webhook | ||
|
|
||
| To create a webhook, send a request to the [Create a webhook](/docs/webhooks/webhooks/manage-webhooks-bulk#create-a-webhook) endpoint. You must use a BigCommerce store- or app-level API account to authenticate the request; it does not support the API tokens created in your [B2B Edition API Account settings](https://support.bigcommerce.com/s/article/B2B-Edition-Settings). Your API account must have the **B2B Edition** scope set to *modify*. | ||
|
|
||
| The following example creates a webhook that subscribes to creation events for Company accounts. | ||
|
|
||
| ```http filename="Example request: Create a webhook" showLineNumbers copy | ||
| POST https://api.bigcommerce.com/stores/{{STORE_HASH}}/v3/hooks | ||
| X-Auth-Token: {{ACCESS_TOKEN}} | ||
| Content-Type: application/json | ||
| Accept: application/json | ||
| { | ||
| "scope": "store/company/created", | ||
| "destination": "https://placeholder.ngrok.io/webhooks", // replace placeholder.ngrok.io with your HTTPS tunnel URL | ||
| "is_active": true | ||
| } | ||
| ``` | ||
|
|
||
| <Callout type="info"> | ||
|
|
||
| * The `destination` URL must be served on port **443**; custom ports are not currently supported. | ||
| * It can take up to one minute for a newly created webhook to work. | ||
| </Callout> | ||
|
|
||
| For information on creating a webhook, consult the [creating a webhook section of the Webhooks Overview](/docs/integrations/webhooks#creating-a-webhook). | ||
|
|
||
| ## Callback structure | ||
|
|
||
| For information on webhook callback payload properties, see [Webhook Events](/docs/integrations/webhooks/events#callback-structure). | ||
|
|
||
| ## Companies | ||
|
|
||
| The following webhooks fire in response to changes to Company account records. You can use them to track new Company account requests across your storefront channels, updates to Company information, or changes in a Company's activity status. | ||
bc-Vince marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| | Name / Scope | Description | | ||
| |:------------------------|:------------| | ||
| | store/company/created | Fires when a new Company account is created in the storefront, from the B2B Edition control panel, or via the API. Note that this webhook does not fire when the REST Management [Bulk Create Companies](/b2b-edition/apis/rest-management/company/companies#bulk-create-companies) endpoint is used. | | ||
bc-Vince marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| | store/company/updated | Fires when a Company’s basic information is updated, including: <br />- Company name <br />- Email address <br />- Phone number <br />- Assigned customer group ID (Must be using [Independent Companies](https://support.bigcommerce.com/s/article/Companies-and-Customer-Groups) behavior) <br />- Legal address <br />- UUID <br />- Activity status<br />- Parent Company (Must be using [Account Hierarchy](https://support.bigcommerce.com/s/article/B2B-Edition-Account-Hierarchy)) <br />- Assigned price list (Must be using Dependent Companies behavior) <br />- Company extra field values | | ||
| | store/company/deleted | Fires when a Company account is deleted from the B2B Edition control panel or via the API. | | ||
bc-Vince marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| | store/company/statusUpdated | Fires when a Company's activity status changes, such as when a pending Company account is approved. | | ||
|
|
||
| ```json filename="Example Company created payload object" showLineNumbers copy | ||
| { | ||
| "scope": "store/company/created", | ||
| "store_id": "123456", | ||
| "data": { | ||
| "company_id": 1234 | ||
| }, | ||
| "hash": "352e4afc6dd3fc85ea26bfdf3f91852604d57528", | ||
| "created_at": 1561482670, | ||
| "producer": "stores/{store_hash}" | ||
| } | ||
| ``` | ||
|
|
||
| ## Company Users | ||
|
|
||
| The following webhooks fire in response to changes to Company users. These are B2B customers with a Buyer Portal account connected to a Company. Changes to B2C customers, guest shoppers, and Super Admins do not trigger these webhooks. | ||
bc-Vince marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| | Name / Scope | Description | | ||
| |:------------------------|:------------| | ||
| | store/company/user/created | Fires when a new Company user is created in the storefront, from the B2B Edition control panel, or via the API. | | ||
| | store/company/user/updated | Fires when a Company user's account information is updated, including: <br />- User name <br />- Email address <br />- Phone number <br />- Company user extra field values | | ||
| | store/company/user/deleted | Fires when a Company user is deleted in the storefront, from the B2B Edition control panel, or via the API. | | ||
bc-Vince marked this conversation as resolved.
Show resolved
Hide resolved
bc-Vince marked this conversation as resolved.
Show resolved
Hide resolved
bc-Vince marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ```json filename="Example Company user created payload object" showLineNumbers copy | ||
| { | ||
| "scope": "store/company/user/created", | ||
| "store_id": "123456", | ||
| "data": { | ||
| "company_id": 123456, | ||
| "user_id": 321 | ||
| }, | ||
| "hash": "352e4afc6dd3fc85ea26bfdf3f91852604d57528", | ||
| "created_at": 1561482670, | ||
| "producer": "stores/{store_hash}" | ||
| } | ||
| ``` | ||
|
|
||
| ## Company Addresses | ||
|
|
||
| The following webhooks fire in response to changes to addresses saved to Company accounts. Changes to addresses on B2C customer accounts use [Customers webhooks](https://developer.bigcommerce.com/docs/integrations/webhooks/events#customers) instead. | ||
bc-Vince marked this conversation as resolved.
Show resolved
Hide resolved
bc-Vince marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| | Name / Scope | Description | | ||
| |:------------------------|:------------| | ||
| | store/company/address/created | Fires when a new Company address is saved to a Company in the storefront, from the B2B Edition control panel, or via the API. | | ||
| | store/company/address/updated | Fires when any field on an existing Company address is updated, including Company address extra field values. | | ||
| | store/company/address/deleted | Fires when a Company address is deleted in the storefront, from the B2B Edition control panel, or via the API. | | ||
|
|
||
| ```json filename="Example Company address created payload object" showLineNumbers copy | ||
| { | ||
| "scope": "store/company/address/created", | ||
| "store_id": "123456", | ||
| "data": { | ||
| "company_id": 123456, | ||
| "address_id": 1234 | ||
| }, | ||
| "hash": "352e4afc6dd3fc85ea26bfdf3f91852604d57528", | ||
| "created_at": 1561482670, | ||
| "producer": "stores/{store_hash}" | ||
| } | ||
| ``` | ||
|
|
||
| ## Super Admins | ||
|
|
||
| The following webhooks fire in response to changes to [Super Admins](https://developer.bigcommerce.com/b2b-edition/apis/rest-storefront/sales-rep), sales staff who assist Company users from the Buyer Portal. | ||
|
|
||
| | Name / Scope | Description | | ||
| |:------------------------|:------------| | ||
| | store/superadmin/created | Fires when a new Super Admin is created the B2B Edition control panel or via the API. | | ||
bc-Vince marked this conversation as resolved.
Show resolved
Hide resolved
bc-Vince marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| | store/superadmin/updated | Fires when a Super Admin's account information is updated, including: <br />- Email address <br />- Name <br />- Phone number <br />- Assigned/Unassigned Company accounts | | ||
bc-Vince marked this conversation as resolved.
Show resolved
Hide resolved
bc-Vince marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| | store/superadmin/deleted | Fires when a Super Admin is deleted from the B2B Edition control panel or via the API. | | ||
bc-Vince marked this conversation as resolved.
Show resolved
Hide resolved
bc-Vince marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ```json filename="Example Company address created payload object" showLineNumbers copy | ||
| { | ||
| "scope": "store/superadmin/created", | ||
| "store_id": "123456", | ||
| "data": { | ||
| "user_id": 1234 | ||
| }, | ||
| "hash": "352e4afc6dd3fc85ea26bfdf3f91852604d57528", | ||
| "created_at": 1561482670, | ||
| "producer": "stores/{store_hash}" | ||
| } | ||
| ``` | ||
|
|
||
| ## Resources | ||
|
|
||
| ### Related Articles | ||
|
|
||
| * [Webhooks Overview](https://developer.bigcommerce.com/docs/integrations/webhooks) | ||
| * [Webhook Events](https://developer.bigcommerce.com/docs/integrations/webhooks/events) | ||
| * [Webhooks Reference](https://developer.bigcommerce.com/docs/webhooks/webhooks) | ||
| * [B2B Edition Reference](https://developer.bigcommerce.com/b2b-edition/apis) | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.