SHOPIFY CUSTOMER UPDATE - Atualizar Cliente do Shopify
O que é este Node?
O SHOPIFY CUSTOMER UPDATE é o node responsável por atualizar informações de clientes existentes no Shopify.
Por que este Node existe?
Manter dados de clientes atualizados é essencial para comunicação e envios.
Como funciona internamente?
Código interno (shopify.executor.ts:100-104):
case 'update': {
const customerId = this.replaceVariables(node.data.customerId, context.variables);
const customer = JSON.parse(this.replaceVariables(JSON.stringify(node.data.customer), context.variables));
const response = await axios.put(`${baseUrl}/customers/${customerId}.json`, { customer }, { headers });
result = response.data;
break;
}
Parâmetros
| Campo | Tipo | Obrigatório | Descrição |
|---|---|---|---|
| config.shopName | string | Sim | Nome da loja |
| config.accessToken | string | Sim | Token de acesso |
| customerId | string/number | Sim | ID do cliente |
| customer | object | Sim | Campos a atualizar |
| responseVariable | string | Não | Variável (padrão: shopifyResult) |
Exemplo: Atualizar Telefone do Cliente
{
"name": "Shopify - Atualizar Telefone",
"nodes": [
{
"id": "start_1",
"type": "start",
"position": { "x": 100, "y": 100 },
"data": { "label": "Início" }
},
{
"id": "input_1",
"type": "input",
"position": { "x": 300, "y": 100 },
"data": {
"label": "ID Cliente",
"parameters": {
"message": "Digite o ID do cliente:",
"variable": "customerId"
}
}
},
{
"id": "phone_1",
"type": "phone",
"position": { "x": 500, "y": 100 },
"data": {
"label": "Novo Telefone",
"parameters": {
"message": "Digite o novo telefone:",
"variable": "newPhone"
}
}
},
{
"id": "shopify_1",
"type": "shopify",
"position": { "x": 700, "y": 100 },
"data": {
"label": "Atualizar",
"operation": "update",
"resource": "customers",
"config": {
"shopName": "minhaloja",
"accessToken": "shpat_xxxxxxxxxxxxx"
},
"customerId": "{{customerId}}",
"customer": {
"phone": "{{newPhone}}"
},
"responseVariable": "updated"
}
},
{
"id": "message_1",
"type": "message",
"position": { "x": 900, "y": 100 },
"data": {
"label": "Confirmação",
"parameters": {
"message": "✅ Telefone atualizado!\n\nNovo telefone: {{newPhone}}"
}
}
},
{
"id": "end_1",
"type": "end",
"position": { "x": 1100, "y": 100 },
"data": { "label": "Fim" }
}
],
"edges": [
{ "source": "start_1", "target": "input_1" },
{ "source": "input_1", "target": "phone_1" },
{ "source": "phone_1", "target": "shopify_1" },
{ "source": "shopify_1", "target": "message_1" },
{ "source": "message_1", "target": "end_1" }
]
}
Resposta do Node
{
"customer": {
"id": 6234567890123,
"email": "joao@example.com",
"phone": "+5511988888888",
"updated_at": "2025-01-15T11:30:00-03:00"
}
}
Boas Práticas
SIM: - Busque cliente antes de atualizar para ter dados atuais - Atualize apenas campos necessários - Valide dados antes de enviar
NÃO: - Não atualize sem validar se cliente existe - Não envie dados inválidos
Dicas
Dica 1: Atualização é parcial - apenas campos enviados são alterados.
Dica 2: Use GET antes de UPDATE para confirmar que cliente existe.
Dica 3: Tags podem ser atualizadas para segmentação.
Próximo Node
→ SHOPIFY CUSTOMER GET - Buscar antes de atualizar → SHOPIFY CUSTOMER SEARCH - Buscar por email