Mensagens enviadas e recebidas
A tabela dim_message armazena todas as mensagens enviadas e recebidas. Com dados atualizados em H-1 (de hora em hora).
Atenção: Os registros desta tabela utilizam o fuso horário UTC, ou seja, para que as datas sejam referentes ao fuso horário brasileiro, é preciso inserir nas queries o fuso horário brasileiro.
SET TIME ZONE '-03:00';
SELECT tb.status
,tb.type
,count(tb.message_id) AS qtd_mensagens
FROM dim_message AS tb
WHERE tb.created_at >= '2025-04-01'
AND tb.is_annotation = FALSE
AND tb.campaign_id IS NULL
GROUP BY ALL
;
Dicionário de dados
Variável | Tipo | Descrição | Obs |
attachment_name | string | Nome do anexo enviado | |
attachment_url | string | Link da web que o anexo foi armazenado | |
campaign_id | string | Id da campanha que essa mensagem está vinculada (Pode ser vinculada com outras tabelas pela coluna campaign_id). | Chave estrangeira para a tabela dim_campaign |
chat_id | string | Id do chat que essa mensagem faz parte (Pode ser vinculada com outras tabelas pela coluna chat_id) | Chave estrangeira para a tabela dim_customer_support_request |
content | string | Texto da mensagem. | |
created_at | timestamp | Data da criação desse registro | |
csr_id | string | Represents the customer support request associated with the message, allowing tracking of customer support issues. | Chave estrangeira para a tabela dim_customer_support_request |
delivered_at | timestamp | Horário da entrega realizada | |
error_code | string | Código do erro caso tenha acontecido | |
error_description | string | Descrição do erro caso tenha acontecido | The requested phone number has been deleted. User phone number is part of an experiment from Meta for user experience and engagement. The error is related to usage or engament policies. Please, check the usage terms and policies. Length of the parameters and the template text exceeds the allowed length of 1024. The payload sent to the broker problably has wrong parameters. The integration is misconfigured or the broker changed something that started to crash for one or more accounts. Broker returning 5XX error. Problem with customer equipment, too old, update required, not compatible. The media trying to be sent is not supported. Too many requests. Message not supported or too long. Template is disabled. Unknown error. Template is paused. |
is_annotation | boolean | Flag para controle se essa mensagem é uma anotação | |
message_id | string | Id interno da mensagem, utilizado para vincular à outras tabelas (pela coluna message_id das mesmas) | |
platform | string | Indica o canal que ocorreu a troca de mensagem | |
read_at | timestamp | Data da leitura da mensagem | |
replied_at | string | Data da resposta da mensagem | |
retailer_id | string | Id interno do cliente | |
status | string | Status da mensagem | INCOMING_READ, OUTGOING_CREATED, OUTGOING_READ, INCOMING_DELETED, OUTGOING_SENT, OUTGOING_SILENT, OUTGOING_DELIVERED, EXTERNAL_OUTGOING_SILENT, INCOMING_RECEIVED, OUTGOING_ERROR |
structured_data | string | Apresentação dos dados estruturados | |
structuredData | string | O campo structuredData foi criado fora do padrão, esse será removido até 28/11/2025, favor utilizar o campo structured_data | |
template_id | string | Id do template utilizado nessa mensagem (Pode ser vinculada com outras tabelas pela coluna template_id) | Chave estrangeira para a tabela dim_templates |
template_tokens | string | Variáveis utilizadas na mensagem substituem {{1}} no texto. | |
type | string | Tipo da mensagem | GROUPED, AUDIO, STICKER, VARIANT, LOCATION, VCARD, SNOOZE_END, PAYMENT_REQUEST, IMAGE, ROUTING, REACTION, SNOOZE_START, BUTTON, ORDER_STATUS, INTERACTIVE, TEMPLATE, VIDEO, ORDER_PREVIEW, TEXT, COLLECTION, FILE, SUMMARY, DOCUMENT |
updated_at | timestamp | Data da ultima atualização desse registro | |
user_id | string | Id do atendente responsável por aquela mensagem (pode ser vinculada a outras tabelas pela coluna user_id) | Chave estrangeira para a tabela dim_user |
