SEND_STICKER - Enviar Sticker
O que é este Node?
O SEND_STICKER é o node responsável por enviar stickers (figurinhas) via WhatsApp Business API.
Por que este Node existe?
Stickers são comunicação divertida. O SEND_STICKER existe para:
- Engajamento: Tornar conversas mais leves e divertidas
- Branding: Enviar stickers personalizados da marca
- Expressão: Comunicar emoções visualmente
- Marketing: Stickers promocionais
- Gamificação: Recompensas visuais
Como funciona internamente?
Quando o SEND_STICKER é executado, o sistema:
- Valida fonte: Verifica stickerUrl ou stickerId
- Constrói payload: Cria objeto tipo 'sticker'
- Não adiciona caption: Stickers não suportam legenda
- Envia para API: POST com tipo sticker
- Retorna message_id: Confirma envio
Código interno (whatsapp-meta-executor.service.ts:436-464):
private async sendSticker(data: WhatsAppMetaNodeData): Promise<any> {
const stickerObject: any = {};
if (data.stickerId) {
stickerObject.id = data.stickerId;
} else {
stickerObject.link = data.stickerUrl;
}
const payload = {
messaging_product: 'whatsapp',
to: data.recipientPhone,
type: 'sticker',
sticker: stickerObject
};
const response: AxiosResponse = await axios.post(
`${this.WHATSAPP_API_BASE}/${data.phoneNumberId}/messages`,
payload,
{
headers: {
'Authorization': `Bearer ${data.accessToken}`,
'Content-Type': 'application/json'
}
}
);
return response.data;
}
Parâmetros
| Campo | Tipo | Obrigatório | Descrição |
|---|---|---|---|
| operation | string | Sim | Deve ser "send_sticker" |
| accessToken | string | Sim | Token de acesso da WhatsApp Business API |
| phoneNumberId | string | Sim | ID do número WhatsApp Business |
| recipientPhone | string | Sim | Número do destinatário |
| stickerUrl | string | Condicional | URL do sticker (obrigatório se sem stickerId) |
| stickerId | string | Condicional | ID do sticker (obrigatório se sem stickerUrl) |
Exemplo Completo: Celebração
{
"name": "Enviar Celebração - SEND_STICKER",
"nodes": [
{
"id": "start_1",
"type": "start",
"position": { "x": 100, "y": 100 },
"data": { "label": "Início" }
},
{
"id": "message_1",
"type": "message",
"position": { "x": 300, "y": 100 },
"data": {
"label": "Parabenizar",
"parameters": {
"message": "🎉 Parabéns pela compra!"
}
}
},
{
"id": "whatsapp_1",
"type": "whatsapp_meta",
"position": { "x": 500, "y": 100 },
"data": {
"label": "Enviar Sticker",
"parameters": {
"operation": "send_sticker",
"accessToken": "EAAxxxxxxxx",
"phoneNumberId": "123456789",
"recipientPhone": "5511999999999",
"stickerUrl": "https://stickers.empresa.com/celebration.webp"
}
}
},
{
"id": "end_1",
"type": "end",
"position": { "x": 700, "y": 100 },
"data": { "label": "Fim" }
}
],
"edges": [
{ "source": "start_1", "target": "message_1" },
{ "source": "message_1", "target": "whatsapp_1" },
{ "source": "whatsapp_1", "target": "end_1" }
]
}
Requisitos de Stickers
- Formato: WebP com transparência
- Tamanho: 512x512 pixels (exato)
- Tamanho arquivo: Máximo 100KB
- Fundo: Transparente (recomendado)
Boas Práticas
✅ SIM: - Use formato WebP - Dimensões exatas 512x512px - Fundo transparente - Arquivo < 100KB
❌ NÃO: - Não use PNG/JPG (use WebP) - Não use dimensões diferentes - Não ultrapasse 100KB - Não tente adicionar caption
Dicas
💡 Criação: Use ferramentas como Sticker Maker 💡 Conversão: Use ImageMagick ou online converters para WebP 💡 Compressão: Use cwebp tool para otimizar tamanho 💡 Sem caption: Envie mensagem de texto separada se necessário
Próximo Node
→ SEND_IMAGE - Enviar imagens → SEND_MESSAGE - Enviar texto