Skip to content

AI-powered sales recovery

Beta feature

AI-powered sales recovery lets you register an abandoned cart — a customer who started checkout but didn't complete the payment — so Appmax can automatically attempt to recover that sale using artificial intelligence.

There's no separate endpoint for this: the abandoned cart is created through the same create or update customer endpoint, by sending the additional cart_link field with the cart's URL.

Prerequisite

To create a customer, you need to have collected the IP using the Appmax JS script.

Request

bash
curl --request POST \
     --url https://api.appmax.com.br/v1/customers \
     --header 'Authorization: Bearer YOUR_TOKEN' \
     --header 'Content-Type: application/json' \
     --data '{
  "first_name": "Junior",
  "last_name": "Almeida",
  "email": "[email protected]",
  "phone": "51983655100",
  "document_number": "25226493029",
  "cart_link": "https://subdomain.domain.com/cart/123-345-678",
  "address": {
    "postcode": "91520270",
    "street": "Rua Francisco Carneiro da Rocha",
    "number": "582",
    "complement": "Casa",
    "district": "Moinhos de Ventos",
    "city": "Porto Alegre",
    "state": "RS"
  },
  "ip": "127.0.0.1",
  "products": [
    {
      "sku": "9000010",
      "name": "Recipe book",
      "quantity": 1,
      "unit_value": 12300,
      "type": "digital"
    }
  ],
  "tracking": {
    "utm_source": "google",
    "utm_campaign": "test"
  }
}'

Body fields

FieldTypeRequiredDescription
first_namestringCustomer's first name
last_namestringCustomer's last name
emailstringValid email
phonestringPhone number with area code
ipstringOrigin IP
productsarrayList of linked products
cart_linkstringAbandoned cart URL
document_numberstringCPF or CNPJ
addressobjectCustomer's address
trackingobjectVisit source data (UTMs)

The remaining fields follow the same contract as the create or update customer endpoint.

Response

201 — customer created successfully

json
{
  "data": {
    "customer": {
      "id": 1
    }
  }
}

Important

Save the customer_id returned at this step, even temporarily. You'll need it to create the order if the customer completes the purchase.

422 — validation error

json
{
  "message": "The given data failed to pass validation.",
  "errors": {
    "message": {
      "first_name": ["The first_name field is required."],
      "last_name": ["The last_name field is required."],
      "phone": ["The phone field must be a string.", "The phone field must have a maximum of 11 characters."],
      "email": ["The email field is required.", "The email field must be a string."],
      "ip": ["The ip field is required."]
    }
  }
}

See also