Skip to content

Commit 37c9a52

Browse files
Alex LyzunAlex Lyzun
authored andcommitted
Review alignments
1 parent dae38d4 commit 37c9a52

7 files changed

Lines changed: 39 additions & 135 deletions

File tree

INSTALL.md

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Go to the [Adobe developer console](https://developer.adobe.com/console) portal
1212
- I/0 events
1313
- Adobe I/O Events for Adobe Commerce
1414
- I/O management API
15-
- Download the [workspace configuration JSON](https://developer.adobe.com/commerce/extensibility/events/project-setup/#download-the-workspace-configuration-file) file and save it as `workspace.json` in the `./scripts/onboarding/config` starter kit folder because you will use it to configure Adobe IO Events in commerce afterward.
15+
- Download the [workspace configuration JSON](https://developer.adobe.com/commerce/extensibility/events/project-setup/#download-the-workspace-configuration-file) file and save it as `workspace.json` in the `./scripts/onboarding/config` folder because you will use it to configure Adobe IO Events in commerce afterward.
1616

1717
### Configure a new Integration in commerce
1818
Configure a new Integration to secure the calls to Commerce from App Builder using OAuth by following these steps:
@@ -24,7 +24,7 @@ Configure a new Integration to secure the calls to Commerce from App Builder usi
2424
![Alt text](docs/integration-all-apis-access.png "New Integration")
2525
- Click Save.
2626
- In the list of integrations, activate your integration.
27-
- To configure the starter kit, you will need the integration details (consumer key, consumer secret, access token, and access token secret).
27+
- To configure the module, you will need the integration details (consumer key, consumer secret, access token, and access token secret).
2828

2929
### Install Commerce Eventing module (only required when running Adobe Commerce versions 2.4.4 or 2.4.5)
3030
Install Adobe I/O Events for Adobe Commerce module in your commerce instance following this [documentation](https://developer.adobe.com/commerce/extensibility/events/installation/)
@@ -34,8 +34,8 @@ Install Adobe I/O Events for Adobe Commerce module in your commerce instance fol
3434
> By upgrading the Adobe I/O Events for Adobe Commerce module to version 1.6.0 or greater, you will benefit from some additional automated steps during onboarding.
3535
3636

37-
## Starter Kit first deploy & onboarding
38-
Following the next steps, you will deploy and onboard the starter kit for the first time. The onboarding process sets up event providers and registrations based on your selection.
37+
## Commerce to Hubspot integration first deploy & onboarding
38+
Following the next steps, you will deploy and onboard the integration for the first time. The onboarding process sets up event providers and registrations based on your selection.
3939

4040
### Download the project
4141
- Download and unzip the project
@@ -48,7 +48,7 @@ Install the npm dependencies using the command:
4848
npm install
4949
```
5050

51-
This step will connect your starter kit project to the App builder project you created earlier.
51+
This step will connect your project to the App builder project you created earlier.
5252
Ensure to select the proper Organization > Project > Workspace with the following commands:
5353
```bash
5454
aio login
@@ -72,7 +72,7 @@ You can confirm the success of the deployment in the Adobe Developer Console by
7272
![Alt text](docs/console-user-defined-actions.png "Workspace runtimes packages")
7373

7474
#### Execute the onboarding
75-
This step will generate the IO Events providers and the registrations for your starter kit project.
75+
This step will generate the IO Events providers and the registrations for your project.
7676
If your Commerce instance Adobe I/O Events for Adobe Commerce module version 1.6.0 or greater, the module will also be automatically configured by the onboarding script.
7777
To start the process run the command:
7878
```bash
@@ -126,10 +126,9 @@ Here are the events with the minimal required fields you need to subscribe to, i
126126
127127
| Entity | Event | Required fields | REST API Ref |
128128
|----------------|--------------------------------------------------------|-----------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
129-
| Customer | observer.customer_save_commit_after | created_at, updated_at | customer [create](https://adobe-commerce.redoc.ly/2.4.6-admin/tag/customers#operation/PostV1Customers) / [update](https://adobe-commerce.redoc.ly/2.4.6-admin/tag/customerscustomerId#operation/PutV1CustomersCustomerId) |
130-
| Customer | observer.customer_delete_commit_after | entity_id | customer [delete](https://adobe-commerce.redoc.ly/2.4.6-admin/tag/customerscustomerId#operation/DeleteV1CustomersCustomerId) |
131-
| Order | observer.sales_order_save_commit_after | id, status, company_name, legal_name, company_email | order update ([hold](https://adobe-commerce.redoc.ly/2.4.6-admin/tag/ordersidhold#operation/PostV1OrdersIdHold), [unhold](https://adobe-commerce.redoc.ly/2.4.6-admin/tag/ordersidunhold#operation/PostV1OrdersIdUnhold), [cancel](https://adobe-commerce.redoc.ly/2.4.6-admin/tag/ordersidcancel#operation/PostV1OrdersIdCancel), [emails](https://adobe-commerce.redoc.ly/2.4.6-admin/tag/ordersidemails#operation/PostV1OrdersIdEmails)) |
132-
| Company | com.adobe.commerce.observer.company_save_commit_after | created_at, updated_at | company update create |
129+
| Customer | observer.customer_save_commit_after | id, firstname, lastname, email, created_at, updated_at | customer [create](https://adobe-commerce.redoc.ly/2.4.6-admin/tag/customers#operation/PostV1Customers) / [update](https://adobe-commerce.redoc.ly/2.4.6-admin/tag/customerscustomerId#operation/PutV1CustomersCustomerId) |
130+
| Company | observer.observer.company_save_commit_after | id, status, company_name, legal_name, company_email | company [create](https://adobe-commerce.redoc.ly/2.4.6-admin/tag/company#operation/PostV1Company) |
131+
| Order | observer.sales_order_save_commit_after | id, increment_id, created_at, updated_at | order create [get](https://adobe-commerce.redoc.ly/2.4.6-admin/tag/orders#operation/GetV1Orders) |
133132
134133
135134
@@ -141,18 +140,25 @@ Hubspot is an integrated system and to connect Adobe Commerce with Hubspot you n
141140
142141
Go to Data Management -> Integrations and create a new App.
143142
144-
Inside of the created app you can switch to "Auth" tab and receive Access Token.
143+
Inside of the created app you can switch to "Auth" tab and receive an Access Token.
145144
146-
Add to .env file of the project the following variable and add your valie here:
145+
Add to .env file of the project the following variable and add your value here:
147146
148147
```
149148
HUBSPOT_ACCESS_TOKEN=
150149
```
151150
151+
Additionally you have to add to .env file:
152+
153+
```
154+
COMMERCE_HUBSPOT_CONTACT_ID_FIELD=
155+
```
156+
157+
It's an Adobe Commerce customer custom attribute code, which will be used to save Hubspot Customer ID, so in case if customer already being exported to Hubspot, system will perform Update and not Create action
152158
153159
### Hubspot -> Adobe Commerce sync
154160
155-
Part of hubspot integration is to allow to sync back to Adobe commerce if some information being changed on Hubspot side
161+
Part of the tion HubSpot integration involves enabling the synchronization of changes made in HubSpot back to Adobe Commerce.
156162
157163
Currently supported:
158164
@@ -181,35 +187,41 @@ So your custom code configuration will look at the end like following:
181187
182188
![alt text](docs/hubspot/hubspot-flow-custom-code.png)
183189
190+
#### Create new attributes (for B2B only)
191+
192+
In case you plan to use Companies synchronization, please create new attribute for Hubspot Contact:
193+
194+
`external_company_id` - Text field. It will be used by script to save Adobe Commerce Customer ID there.
195+
184196
#### Manual Configuration (optional)
185197
186198
If automated way is not an option for you, you can create them manually.
187199
188-
On Hubport pls go to Automations -> Workflows -> Create a Workflow from scratch
200+
On Hubport go to Automations -> Workflows -> Create a Workflow from scratch
189201
190202
##### Shipment sync
191203
192-
For shipment sync pls choose "Order" as main automation object.
204+
For shipment sync choose "Order" as main automation object.
193205
194206
Create the following automation:
195207
196208
![alt text](docs/hubspot/hubspot-shipment.png)
197209
198-
Custom script you can find:
210+
You can find the custom script in:
199211
200212
```
201213
scripts/lib/hubspot/workflow_shipment.js
202214
```
203215
204216
##### Customer sync
205217
206-
For shipment sync pls choose "Customer" as main automation object.
218+
For shipment sync choose "Customer" as main automation object.
207219
208220
Create the following automation:
209221
210222
![alt text](docs/hubspot/hubspot-customer.png)
211223
212-
Pls create group for each of attribute changed:
224+
Create group for each of attribute changed:
213225
214226
* firstname
215227
* lastname
@@ -228,7 +240,7 @@ scripts/lib/hubspot/workflow_customer.js
228240
229241
## Run initial synchornization
230242
231-
After you are done with installation steps, you can run initial synchronization. Module provides an API endpoint start the sync process:
243+
After you are done with installation steps, you can run initial synchronization. Module provides an API endpoint to start the sync process:
232244
233245
```
234246
curl --request POST \

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
# Commerce Integration Starter Kit
1+
# Adobe App Builder integration for Adobe Commerce and Hubspot
22

3-
The integration between Adobe Commerce and HubSpot facilitates seamless data synchronization and management across customer, company, and order domains. Here's a brief description:
3+
The integration between Adobe Commerce and HubSpot facilitates seamless data synchronization and management across customer, company, and order domains.
4+
5+
This application serves as a reference implementation for integrating HubSpot and Adobe Commerce. It is designed to demonstrate basic integration features and provide a foundational starting point for further development. Users are encouraged to extend and customize the application to meet specific business requirements and leverage additional functionalities beyond the basic features provided.
6+
7+
Here's a brief description:
48

59
## Adobe Commerce to HubSpot Integration
610

actions/customer/commerce-customer-group-api-client.js

Lines changed: 0 additions & 107 deletions
This file was deleted.

actions/customer/commerce/actions.config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ consumer:
66
LOG_LEVEL: debug
77
COMMERCE_HUBSPOT_CONTACT_ID_FIELD: $COMMERCE_HUBSPOT_CONTACT_ID_FIELD
88
HUBSPOT_ACCESS_TOKEN: $HUBSPOT_ACCESS_TOKEN
9-
HUBSPOT_COMMERCE_COMPANY_ID_FIELD: $HUBSPOT_COMMERCE_COMPANY_ID_FIELD
109
annotations:
1110
require-adobe-auth: true
1211
final: true

actions/customer/external/batch/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ async function main (params) {
3737
}
3838
logger.debug('Process finished successfully')
3939
return actionSuccessResponse(JSON.stringify(result))
40-
// return actionSuccessResponse('Customer created successfully')
4140
} catch (error) {
4241
logger.error(`Error processing the request: ${error}`)
4342
return actionErrorResponse(HTTP_INTERNAL_ERROR, error.message)

actions/customer/external/updated/transformer.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ function transformData (params, customer) {
2424

2525
const defaultBilling = customer.addresses?.find(address => address.default_billing)
2626
const addressId = defaultBilling?.id ? defaultBilling.id : 0
27-
// TODO: If adding a new address firstname, lastname and telephone and country_id are required
28-
// TODO add telephone as a field of the backoffice customer update event to be included in here
27+
28+
// If adding a new address firstname, lastname and telephone and country_id are required. Can be removed it aligned on Hubspot side
2929
const telephoneNumber = '1234567890'
3030

3131
logger.debug('Address ID: ', addressId)
@@ -39,8 +39,6 @@ function transformData (params, customer) {
3939
id: addressId,
4040
street: [params.data.address],
4141
city: params.data.city,
42-
// ToDo: figure out how to get region ID by the code, county_id and region_id depend on each other
43-
// region_id: params.data.state ,
4442
country_id: params.data.country,
4543
postcode: params.data.zip,
4644
default_billing: true,

env.dist

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ IO_WORKSPACE_ID=
3737
HUBSPOT_ACCESS_TOKEN=
3838

3939
COMMERCE_HUBSPOT_CONTACT_ID_FIELD=
40-
HUBSPOT_COMMERCE_COMPANY_ID_FIELD=external_company_id
4140

4241
#HUBSPOT CONTACT FULL IMPORT CONFIG, related with the runtime action customer-backoffice/full-import
4342
HUBSPOT_FULL_IMPORT_CONTACT_GROUP_ID=

0 commit comments

Comments
 (0)