> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mavera.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Shopify

> 8 production-ready jobs — customer cohort personas, product review analysis, collection content generation, abandoned cart focus groups, seasonal campaign planning, product bundling validation, inventory-aware content prioritization, and customer metafield persona enrichment

Shopify holds your commerce truth — who buys, what they buy, how often they return, and where they drop off. These eight jobs pull that data through Mavera's surfaces (Custom Personas, Mave Agent, Focus Groups, Generate, Brand Voices) so your personas reflect real purchasing behavior, your content matches actual inventory priorities, and your campaigns are informed by synthetic audience reactions grounded in real customer data.

```mermaid theme={"dark"}
flowchart LR
  subgraph SH["Shopify"]
    Customers
    Products
    Reviews
    Orders
    Inventory
    Metafields
  end

  subgraph MV["Mavera"]
    Personas
    Chat
    FocusGroups["Focus Groups"]
    Mave
    Generate
  end

  subgraph OUT["Outputs"]
    CustomerPersonas["Customer Personas"]
    ReviewAnalysis["Review Analysis"]
    MarketingContent["Marketing Content"]
    CartDiagnosis["Cart Diagnosis"]
    CampaignPlans["Campaign Plans"]
    BundleValidation["Bundle Validation"]
  end

  Customers --> Personas
  Products --> Chat
  Reviews --> Chat
  Orders --> FocusGroups
  Orders --> Mave
  Inventory --> Generate
  Metafields --> Personas

  Personas --> CustomerPersonas
  Chat --> ReviewAnalysis
  Generate --> MarketingContent
  FocusGroups --> CartDiagnosis
  FocusGroups --> BundleValidation
  Mave --> CampaignPlans
```

***

## API Reference Card

| Detail            | Value                                                             |
| ----------------- | ----------------------------------------------------------------- |
| **Base URL**      | `https://{store}.myshopify.com/admin/api/2024-10/graphql.json`    |
| **Auth**          | OAuth 2.0 — `X-Shopify-Access-Token` header                       |
| **Rate limits**   | GraphQL: 50 pts/sec (Standard), 500 pts/sec (Shopify Plus)        |
| **REST fallback** | `https://{store}.myshopify.com/admin/api/2024-10/{resource}.json` |
| **Mavera base**   | `https://app.mavera.io/api/v1`                                    |
| **Mavera auth**   | `Authorization: Bearer mvra_live_...`                             |

<Info>
  All examples use three environment variables: `SHOPIFY_STORE` (your myshopify.com subdomain, e.g. `acme-store`), `SHOPIFY_ACCESS_TOKEN` (private app access token starting with `shpat_`), and `MAVERA_API_KEY`. Python examples use `requests`; JavaScript examples use `fetch`. GraphQL queries target the `2024-10` API version.
</Info>

***

## Prerequisites

<Steps>
  <Step title="Shopify private app with required scopes">
    Create a custom app in Shopify Admin → Settings → Apps and sales channels → Develop apps. Grant scopes: `read_customers`, `read_orders`, `read_products`, `read_inventory`, `read_checkouts`. Copy the **Admin API access token** (starts with `shpat_`).
  </Step>

  <Step title="Mavera API key">
    Get your key from [Mavera dashboard](https://app.mavera.io/settings/api-keys). The key starts with `mvra_live_`.
  </Step>

  <Step title="Install dependencies">
    ```bash theme={"dark"}
    pip install requests openai
    ```
  </Step>

  <Step title="Environment variables">
    ```bash theme={"dark"}
    export SHOPIFY_STORE="acme-store"
    export SHOPIFY_ACCESS_TOKEN="shpat_xxxxx"
    export MAVERA_API_KEY="mvra_live_xxxxx"
    ```
  </Step>
</Steps>

***

## Jobs

| # | Job                                                                        | Shopify Data                          | Mavera Surface          | Output                                           |
| - | -------------------------------------------------------------------------- | ------------------------------------- | ----------------------- | ------------------------------------------------ |
| 1 | [Customer Cohort → Persona Pipeline](customer-cohort-personas)             | Customers with order history          | Custom Personas         | Cohort-segmented persona library                 |
| 2 | [Product Review Analysis](product-review-analysis)                         | Product metafields / Judge.me reviews | Responses               | Sentiment + theme breakdown per product          |
| 3 | [Product Collection → Content Generation](collection-content-generation)   | Collection products                   | Brand Voices + Generate | Marketing copy with brand-consistent voice       |
| 4 | [Abandoned Cart → Focus Group](abandoned-cart-focus-group)                 | Abandoned checkouts                   | Focus Groups            | Abandonment reason insights by segment           |
| 5 | [Seasonal Sales → Campaign Planning](seasonal-campaign-planning)           | Historical orders by month            | Mave Agent              | Data-driven seasonal campaign calendar           |
| 6 | [Product Bundling Validation](product-bundling-validation)                 | Orders with line items                | Focus Groups            | Bundle concept validation scores                 |
| 7 | [Inventory-Aware Content Prioritization](inventory-content-prioritization) | Inventory levels by location          | Generate                | Prioritized content for high-stock items         |
| 8 | [Customer Metafield → Persona Enrichment](metafield-persona-enrichment)    | Customer metafields                   | Custom Personas         | Enriched personas with loyalty + preference data |

***

***

## Rate Limits & Production Notes

| Concern               | Shopify Limit                             | Recommendation                                           |
| --------------------- | ----------------------------------------- | -------------------------------------------------------- |
| **GraphQL cost**      | 50 pts/sec (Standard), 500 pts/sec (Plus) | Check `extensions.cost.throttleStatus` in every response |
| **REST API**          | 2 req/sec (Standard), 20 req/sec (Plus)   | Add 500ms sleep between REST calls                       |
| **Bulk operations**   | 1 concurrent bulk op per app              | Use for > 10k records instead of pagination              |
| **Webhook delivery**  | Push-based                                | Consider webhooks for real-time triggers                 |
| **Mavera rate limit** | Varies by plan                            | Exponential backoff on `429` responses                   |

<Warning>
  **Before going to production:** store tokens in a secrets manager (never commit them), implement exponential backoff with jitter (start 1s, double, cap 30s), use [Shopify Bulk Operations](https://shopify.dev/docs/api/usage/bulk-operations) for 10k+ records, log all API responses for auditing, test on a development store first, and pin your API version to `2024-10`.
</Warning>

### Production Checklist

* [ ] Secrets in env vars or secrets manager
* [ ] Exponential backoff with jitter on all API calls
* [ ] Bulk operations for datasets > 10k records
* [ ] Structured logging and error alerting
* [ ] Tested on Shopify development store
* [ ] API version pinned to `2024-10`; rate limit headers monitored
* [ ] Pagination cursors handled for all list endpoints

***

<CardGroup cols={2}>
  <Card title="Shopify GraphQL Admin API" href="https://shopify.dev/docs/api/admin-graphql" icon="shop">
    Official GraphQL reference with schema explorer.
  </Card>

  <Card title="Mavera API Reference" href="https://app.mavera.io/docs/api" icon="book">
    Personas, focus groups, brand voices, and generations.
  </Card>

  <Card title="Shopify Bulk Operations" href="https://shopify.dev/docs/api/usage/bulk-operations" icon="database">
    Async queries for large datasets.
  </Card>

  <Card title="Integration Quick Reference" href="/cookbooks/integration-quick-reference" icon="bolt">
    Cross-platform patterns for all Mavera integrations.
  </Card>
</CardGroup>
