# VTEX

Order created, paid and invoiced/shipped notices and abandoned cart reminders for VTEX stores.

## Connect {#connect}

In VTEX: **Account settings › Account › Security › API Keys** (or License Manager) create an app key with the *OMS - Full access* role (or order read access). In the portal: Integrations › VTEX: account name (the part before `.myvtex.com`), **App key** and **App token**. On connect we create the VTEX **order hook** (statuses `order-created`, `payment-approved`, `invoiced`) with our own token in the `X-Store-Token` header; orders are also read every few minutes.

VTEX allows one hook per app key: use an app key only for us.

## Abandoned carts {#carts}

VTEX has no abandoned cart API. Send them from a **Master Data trigger** (cart/customer entity, action "Send an HTTP request") or any script to the cart URL shown on the store page, with the `X-Store-Token` header and this JSON body:

```
POST https://app.ogave.co/integrations/vtex/carts/{connection}
{"cart_id": "orderFormId", "phone": "+573001234567", "first_name": "Ana", "cart_url": "https://shop.com/checkout/?orderFormId=…",
 "total": 129900, "currency": "COP", "items": [{"name": "T-shirt", "quantity": 2}]}
```

When the order of that cart (`orderFormId`) or of the same phone arrives, the reminder is cancelled.

## Messages {#messages}

Portal › Integrations › the store: turn each event on and write its text (it starts in your language). Variables: `{first_name}` `{store}` `{order_number}` `{total}` `{currency}` `{items}` `{cart_url}` `{tracking_url}` `{tracking_number}` `{carrier}`. Links become tracked short links.

- **Abandoned cart**: N minutes (15–2880, default 60) after the cart last changed, if no order was placed. Marketing: your quiet hours and frequency caps apply.
- **Order created / paid / shipped**: transactional, once per order (even when the store repeats the notice or the order changes several times).
- Blacklisted and opted-out numbers never get SMS. **Test** mode: simulated SMS, never charged.

## Polling {#polling}

We read the orders and carts changed since the last read every 5 minutes (choose 5, 10, 15, 30 or 60). A failed read is retried over the same window: nothing is lost or sent twice. Only changes after you connected the store are read: older orders never get an SMS. We keep only what the SMS needs (phone, first name, total, cart link); every event is logged on the store page.

**Test connection** reads the store with the saved credentials and sends nothing. **Disconnect** deletes the credentials.
