Add To Cart

Make a call to this endpoint when a user adds a product to their shopping cart.

Example Mutation

Make sure to set the Authorization: Bearer <Unique API Key> on the request. For more information about obtaining a unique API Key please see the Authentication Docs

POST https://api.attentivemobile.com/v1/graphql

Copy
Copied
mutation addToCart($sendInput: SendAddProductToCartEventInput!) {
    addToCartEvent(input: $sendInput) {
        occurredAt
        products {
            productId
            productPrices {
                amount
                currency
            }
        }
        visitor {
            phone
            email
        }
    }
}

Example Input Variable

Copy
Copied
{
    "sendInput": {
        "occurredAt": "2022-03-30T14:38:29+00:00",
        "visitor": {"email": "test@gmail.com", "phone": "8005555555"},
        "products": [{
            "productPrices":
                [{"amount":"7.01", "currency":"CAD"},{"amount":"123.99", "currency":"USD"}]
                ,
            "productId": "productId",
            "productImage": "none.jpeg",
            "productName": "Best Product",
            "productVariantId": "varId",
            "quantity": "1"
            },
            {
            "productPrices":
                [{"amount":"7.01", "currency":"USD"},{"amount":"123.99", "currency":"USD"}]
                ,
            "productId": "productId2",
            "productImage": "blagh2",
            "productName": "pName2",
            "productVariantId": "varId2",
            "quantity": "1"
            }]
    }
}

Example Respnse

Copy
Copied
{
    "data": {
        "addToCartEvent": {
            "occurredAt": "2022-03-30T14:38:29Z",
            "products": [
                {
                    "productId": "productId",
                    "productPrices": [
                        {
                            "amount": "7.01",
                            "currency": "USD"
                        },
                        {
                            "amount": "123.99",
                            "currency": "USD"
                        }
                    ]
                },
                {
                    "productId": "productId2",
                    "productPrices": [
                        {
                            "amount": "7.01",
                            "currency": "USD"
                        },
                        {
                            "amount": "123.99",
                            "currency": "USD"
                        }
                    ]
                }
            ],
            "visitor": {
                "phone": "8005555555",
                "email": "test@gmail.com"
            }
        }
    },
    "extensions": {
        "traceId": "00000"
    }
}