> For the complete documentation index, see [llms.txt](https://docs.dckapintegrator.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dckapintegrator.com/tutorials/workflow-builder-tutorial/5.-best-practices/exercise-9.md).

# 🎯 Exercise 9

### Sync Customers from BigCommerce to Frappe CRM

**Objective:** Practice building a reusable Snippet that creates or updates contacts in Frappe CRM, and calls it multiple times within the same workflow for different customer types.

**Prerequisites:**

* A BigCommerce trial account with at least 2-3 customers — some with a company name and some without
* A Frappe CRM free account
* Go to <https://frappe.io/cloud>. Click Start Free Trial on the top right corner. Continue with Google and create an account. Install CRM and create a site. Complete the set up.
* Go to https\://\<company>.frappe.cloud/app/user and click on your name on the bottom left.
* Under Settings -> App -> Choose CRM and Save.&#x20;
* Now under Settings -> API Access -> Generate Keys and Download.
* Go to https\://\<company>.frappe.cloud/crm/contacts/view/list and add columns for name and status.

**Snippet to Build: Create or Update Contact in Frappe CRM**

Build a Snippet called Create or Update Contact with the following inputs:

| Label        | Key     | Data Type                     | Required |
| ------------ | ------- | ----------------------------- | -------- |
| Contact Data | contact | JSON                          | Yes      |
| Status       | status  | String (Open/Passive/Replied) | Yes      |

Inside the Snippet, build the following steps:

1. Loop through the data,&#x20;
2. Search for the contact in Frappe CRM by email
3. If contact exists, do nothing; if not, create a contact in Frappe CRM
4. When creating contact in Frappe CRM, add success/failure contact creation detailed logs.&#x20;
5. Return the result

**Workflow to Build:**

1. Create a new batch workflow
2. Add the below contact data you got manually as Frappe CRM Contacts via DCKAP Integrator using the Snippet created. Keep the status key of these records as “Open”
3. Contact Data:

```
[
{
   "name": "Brighty",
   "email_id": "brighty@testing.com",
   "phone": "123456789"
},
{
   "name": "John",
   "email_id": "john@testing.com",
   "phone": "987654321"
}
]
```

3. Fetch all customers from BigCommerce and create as Contacts if it doesn’t exist using the created snippet.&#x20;
4. Enable Console Logs, save and run the workflow

Hints:

* Use the customer's email as the unique identifier to check if they already exist in Frappe CRM
* The same Snippet is called twice in this workflow

**Expected Outcome:** All BigCommerce customers are synced as Frappe CRM Contacts. The Detailed Log shows a clear record of which customers were created and which failed.

<br>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.dckapintegrator.com/tutorials/workflow-builder-tutorial/5.-best-practices/exercise-9.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
