Pular para o conteúdo principal

Get ViewBag

Contacts

Get ViewBag

Reads the contact's ViewBag (full or single key)

Node typecontact.getViewBag
CategoriaContacts
Setups obrigatoriosNenhum

Painel de configuracao

Esta visualizacao usa o frontend real do ConfigPanel em modo embed, carregando um no de exemplo com o JSON base desta documentacao.

Preview real do painel

Nao foi possivel carregar o painel embedado automaticamente.

JSON base do node
{
  "_nodeType": "contact.getViewBag",
  "contactId": "",
  "key": ""
}

Portas

Entradas

Input
input · control

Saidas

Output
default · control
Error
error · error

Notas de uso

Output: local.<nodeId>.viewBag → the value of the requested key, or the entire ViewBag object if key is empty.

**Fields:**
- `contactId`: Leave EMPTY for current conversation contact (auto from `{{input.contactId}}`).
- `key`: Specific key to read (e.g., `"cpf"`). Empty = returns entire ViewBag as JSON object.

**Accessing output:**
- Single key: `{{local.<nodeId>.viewBag}}` returns the value directly (string, number, object).
- Full ViewBag: `{{local.<nodeId>.viewBag.cpf}}`, `{{local.<nodeId>.viewBag.email}}`, etc.

**Common patterns:**
- **Check if data exists:** getViewBag(key="cpf") → condition `{"!=":[{"var":"local.<nodeId>.viewBag"},null]}` → true/false branches.
- **Validate value:** getViewBag(key="etapa") → condition `{"==":[{"var":"local.<nodeId>.viewBag"},"confirmado"]}` → branches.
- **Personalize message:** getViewBag(key="nome") → wa.sendText body=`"Olá {{local.<nodeId>.viewBag}}! Como posso ajudar?"`.