Easymailing
Store customers

Create a store customer

POST /stores/{storeResourceId}/customers

POST/stores/{storeResourceId}/customers

Registers a buyer in a store and subscribes them to the store's audience, creating the audience member if it does not exist. If the store has a group, the member is added to it.

When to use: When a shop sends a new buyer, before creating their orders. The customer is needed to create a cart or an order.

When not to use: To update an existing customer use update_store_customer. To add a person to an audience without a store, use create_audience_member.

Side effects: The person is subscribed like in create_audience_member, according to the audience settings: in a double opt-in audience they get a confirmation email and stay unconfirmed until they confirm; in a single opt-in audience they are confirmed at once, the member_subscribed webhook fires, the subscription automations start and the welcome email is sent if the audience has one. Someone who unsubscribed on their own gets a confirmation email instead, but a member unsubscribed with status suscriber.status.unsuscribed.admin is confirmed again at once in a single opt-in audience. The store's group is added to the member. The query flags disable_double_opt_in, disable_welcome_email and disable_sms_double_opt_in (all true/false) turn the confirmation and welcome messages off. When the plan has no room for more subscribers, the customer is still created but nobody is subscribed: the response has no member (or keeps the member the person already had, untouched), and update_store_customer subscribes them once the plan has room.

Permissions: Requires the manager role or higher, or the marketing.audiences.write capability.

Authorization

X-Auth-Token<token>

Value for the X-Auth-Token header parameter.

In: header

Path Parameters

storeResourceId*string

Identifier (resource_id) of the store the customer belongs to.

Query Parameters

disable_double_opt_in?boolean

If true, a customer who is not yet subscribed is subscribed at once, without the double opt-in confirmation email the audience would send.

disable_welcome_email?boolean

If true, the welcome email of the audience is not sent.

disable_sms_double_opt_in?boolean

If true, a customer with a phone number is subscribed to SMS without the confirmation SMS.

Request Body

The new Customer resource

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/problem+json

application/problem+json

application/problem+json

application/problem+json

curl -X POST "https://api.easymailing.com/stores/acme-shop/customers?disable_double_opt_in=false&disable_welcome_email=false&disable_sms_double_opt_in=false" \  -H "X-Auth-Token: YOUR_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "resource_id": "string",    "email": "user@example.com",    "phone": "string",    "company": "string",    "firstname": "string",    "lastname": "string",    "member_consent": {      "ip": "192.168.0.1",      "consent_at": "2019-08-24T14:15:22Z",      "treatment_purposes": [        "/entity/1"      ]    },    "custom_fields": [      {        "list_field": "/entity/1",        "value": "string"      }    ]  }'
{  "resource_id": "string",  "email": "user@example.com",  "phone": "string",  "company": "string",  "firstname": "string",  "lastname": "string",  "member": "/entity/1",  "created_at": "2019-08-24T14:15:22Z",  "updated_at": "2019-08-24T14:15:22Z"}