bling.upsert-contact ​
Create or update a Bling contact (contato). Routes to POST /contatos or PUT /contatos/{id} based on whether contact_external_ref is supplied. Persists the result into commerce_entity.
Overview ​
| Property | Value |
|---|---|
| Workflow type | Atomic |
| Library | App-bling |
| Version | 1.0 |
Input Schema ​
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
organization_uuid | uuid | Yes | — | — |
connection_uuid | uuid | Yes | — | — |
contact_external_ref | string | No | — | Bling-side contact id. Set to UPDATE; omit to CREATE. |
name | string | Yes | — | — |
trade_name | string | No | — | — |
document_number | string | No | — | CPF/CNPJ (Brazilian tax id) |
document_kind | string | No | — | 'cpf' or 'cnpj' — drives Bling field selection |
type | string | No | — | 'customer' |
email | string | No | — | — |
phone | string | No | — | — |
address_street | string | No | — | — |
address_number | string | No | — | — |
address_neighborhood | string | No | — | — |
address_city | string | No | — | — |
address_state | string | No | — | — |
address_postal_code | string | No | — | — |
address_country | string | No | — | — |
actor | string | No | — | — |
Output Schema ​
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
organization_uuid | uuid | Yes | — | — |
connection_uuid | uuid | Yes | — | — |
contact_external_ref | string | No | — | Bling-side contact id. Set to UPDATE; omit to CREATE. |
name | string | Yes | — | — |
trade_name | string | No | — | — |
document_number | string | No | — | CPF/CNPJ (Brazilian tax id) |
document_kind | string | No | — | 'cpf' or 'cnpj' — drives Bling field selection |
type | string | No | — | 'customer' |
email | string | No | — | — |
phone | string | No | — | — |
address_street | string | No | — | — |
address_number | string | No | — | — |
address_neighborhood | string | No | — | — |
address_city | string | No | — | — |
address_state | string | No | — | — |
address_postal_code | string | No | — | — |
address_country | string | No | — | — |
actor | string | No | — | — |
operation | string | No | — | 'create' or 'update' — chosen at runtime |
provider_resource_ref | string | No | — | Bling contact id (post-create or echoed for update) |
commerce_entity_uuid | uuid | No | — | — |
completed_at | string | No | — | — |
failure_reason | string | No | — | — |
failed_at | string | No | — | — |
failure_type | string | No | — | — |
failed_action | string | No | — | — |
failed_at_state | string | No | — | — |
failed_step | json | No | — | — |
failed_layer | json | No | — | — |
error | string | No | — | — |
error_type | string | No | — | — |
States ​
| State | Initial | Terminal | Success | Auto-advance | Description |
|---|---|---|---|---|---|
initiated | Yes | No | — | upsert | Upsert requested |
completed | No | Yes | Yes | — | Contact upserted + persisted |
failed | No | Yes | No | — | Upsert failed |
State Diagram ​
Transitions ​
| From | Action | To | Description |
|---|---|---|---|
initiated | upsert | completed | — |
initiated | fail | failed | — |
Business Errors ​
| Code | Message Template |
|---|---|
BLING_CONNECTION_NOT_FOUND | Bling connection {connection_uuid} not found in organization |
BLING_CONNECTION_WRONG_PROVIDER | Connection {connection_uuid} is not a Bling connection |
BLING_CONTACT_MISSING_NAME | name is required to create or update a Bling contact |
BLING_CONTACT_UPSERT_FAILED | Bling refused contact {operation}: |
BLING_CONTACT_PERSIST_FAILED | commerce_entity persist failed for contact: |
API Usage ​
bash
POST /api/workflows/start
Content-Type: application/json
{
"workflow_type": "bling.upsert-contact",
"initial_data": {
"organization_uuid": "value",
"connection_uuid": "value",
"name": "value"
}
}