---
name: ecommerce-customer-onboarding-automator
description: Automates customer onboarding workflows for e-commerce platforms. Fetches recent WooCommerce orders, identifies first-time customers within a specified timeframe, syncs their information to a BigQuery CRM database, and sends personalized welcome emails using a template.
---
# Instructions

## Objective
Automate the onboarding process for new e-commerce customers by:
1.  Identifying customers who completed their **first order** within the **past 7 days**.
2.  Syncing their core information (name, email, order details) from WooCommerce to a BigQuery CRM table.
3.  Sending a personalized welcome email to each identified customer.

## Prerequisites & Setup
*   **WooCommerce Connection:** Ensure access to the WooCommerce store's API (`woocommerce-woo_orders_list`).
*   **BigQuery Dataset:** Confirm the target BigQuery dataset (e.g., `woocommerce_crm`) and table (e.g., `new_customers`) exist. The table should have at least these columns: `customer_name` (STRING), `email` (STRING), `order_id` (INT64), `order_date` (TIMESTAMP), `order_total` (FLOAT64).
*   **Email Template:** Locate or create the `welcome_email_template.md` file. The skill expects to find it at `/workspace/dumps/workspace/` by default.

## Execution Steps

### 1. Fetch and Analyze Recent Orders
*   Use `woocommerce-woo_orders_list` to retrieve completed orders. Start with parameters: `{"status": ["completed"], "perPage": 100, "order": "desc", "orderby": "date"}`.
*   **Critical Logic:** Analyze the order metadata. In the provided trajectory, orders from first-time customers within the past 7 days were tagged with `"period": "recent_7_days"` in their `meta_data`. You must implement a similar filtering logic based on your store's data structure.
    *   **First-Time Customer Check:** Ensure a customer's email appears only once in the filtered set (or check against a historical customer list in BigQuery if available).
    *   **Date Filtering:** Use the `date_completed` field and calculate if it falls within the last 7 days from the current date.

### 2. Locate and Read the Email Template
*   Use `filesystem-search_files` to find `welcome_email_template.md`.
*   Use `filesystem-read_file` to load its content. The template should contain placeholders like `{{customer_name}}`, `{{order_id}}`, `{{order_total}}`, and `{{order_date}}`.

### 3. Prepare BigQuery Environment
*   Use `google-cloud-bigquery_list_datasets` and `google-cloud-bigquery_get_dataset_info` to verify the target dataset exists.
*   Use `google-cloud-bigquery_run_query` to inspect the `INFORMATION_SCHEMA` and confirm the schema of the target table (e.g., `new_customers`) matches the data you will insert.

### 4. Transform and Sync Customer Data
*   For each identified first-time customer, extract:
    *   `customer_name`: Combine `billing.first_name` and `billing.last_name`.
    *   `email`: From `billing.email`.
    *   `order_id`: The order's `id`.
    *   `order_date`: Convert `date_completed` to a TIMESTAMP.
    *   `order_total`: The order's `total` (as a float).
*   Construct a single `INSERT` query for BigQuery with all customer values. Use parameterized values or explicit casting (e.g., `TIMESTAMP('...')`) to ensure data type compatibility.
*   Execute the insert query using `google-cloud-bigquery_run_query`.
*   **Verification:** Run a `SELECT` query to confirm all records were inserted correctly.

### 5. Generate and Send Welcome Emails
*   For each customer, personalize the email template by replacing the placeholders with their specific data.
*   Use `emails-send_email` to send the email.
    *   **Subject:** Follow the template's subject line.
    *   **Body:** Use the fully personalized email body.
    *   **To:** The customer's email address.
*   Send emails sequentially or in small batches to avoid rate limits.

## Key Decisions & Error Handling
*   **Pagination:** If you have more than 100 recent orders, implement pagination using the `page` parameter in `woocommerce-woo_orders_list`.
*   **Duplicate Prevention:** Before inserting into BigQuery, consider checking if the `email` or `order_id` already exists in the target table to prevent duplicates if the skill runs multiple times.
*   **Template Flexibility:** The skill is designed to use an external template file. If the file is not found, you may need to create a default template or ask the user for its location.
*   **Email Send Errors:** Log or note if any email fails to send, but proceed with the remaining customers.

## Completion
After all emails are sent, provide a summary report including:
*   The number of first-time customers identified.
*   Confirmation of data sync to BigQuery.
*   Confirmation of emails sent.
*   Use `local-claim_done` to mark the task as complete.


---
Source attribution: zjunlp
Original project: https://github.com/zjunlp/SkillNet/blob/665926a2fe4c564dcd79ea54c5246dc8e07cde39/skills/benchmark_skills/toolathlon/ecommerce-customer-onboarding-automator/SKILL.md
License: MIT
License information: https://opensource.org/license/mit
Original upstream instructions; downloaded from Dave AI.

## Upstream license notice

MIT License

Copyright (c) 2026 ZJUNLP

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



# Dave AI resource metadata

Creator / publisher: zjunlp
Original project: https://github.com/zjunlp/SkillNet/blob/665926a2fe4c564dcd79ea54c5246dc8e07cde39/skills/benchmark_skills/toolathlon/ecommerce-customer-onboarding-automator/SKILL.md
Attribution basis: Recovered original package and original project license at a pinned revision

Fields of work: Marketing, Sales
Roles: Customer Success Manager, Email Marketer, Growth Marketer, Marketing Analyst, Product Marketer
Specialties: API, Backend
Tools: Tool not specified
Country applicability: Country not specified
Classification basis: Source catalog labels
Instruction SHA-256: bc8080700809c1d9bdda471b4cca75c64606b852439877a2886e176ef93308d1
Metadata reviewed: 2026-10-27
This metadata supersedes earlier Dave AI catalog attribution. Original instruction and supporting files are preserved.
