Skip to main content
POST
/
integrations
/
external
/
chats
Criação manual de chat
curl --request POST \
  --url https://api.wegly.com.br/integrations/external/chats \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "whatsapp_phone_id": "0b28ee57-7a57-4407-a9c5-5cd4e5a5fd6c",
  "wa_contact_id": "11999999999",
  "template": {
    "name": "saudacao_inicial",
    "language": "pt_BR"
  },
  "template_fields": [
    {
      "component": "BODY",
      "type": "TEXT",
      "index": 1,
      "value": "João"
    }
  ]
}
'
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "wa_contact_id": "<string>",
  "contact_name": "<string>",
  "contact_number": "<string>",
  "status": "OPEN",
  "chat_type": "INDIVIDUAL",
  "unread_count": 123,
  "is_manually_unread": true,
  "priority": 0,
  "archived_at": "2023-11-07T05:31:56Z",
  "assigned_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "phone_number": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "display_number": "<string>"
  },
  "assigned_agent": {
    "agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "user": {
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "name": "<string>",
      "avatar": "<string>"
    }
  },
  "last_message_at": "2023-11-07T05:31:56Z",
  "last_message": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "type": "text",
    "origin": "INBOUND",
    "from_me": true,
    "sent_via": "CONTACT",
    "status": "processing",
    "body_text": "<string>",
    "content_payload": {},
    "reactions": [
      {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "emoji": "<string>",
        "actor": "CONTACT",
        "reactor_wa_id": "<string>",
        "reactor_user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "created_at": "2023-11-07T05:31:56Z"
      }
    ],
    "meta_timestamp": "<string>",
    "is_history": true,
    "history_phase": 123,
    "history_chunk_order": 123,
    "history_progress": 123,
    "is_media_placeholder": true,
    "agent": {
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "user": {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "name": "<string>",
        "avatar": "<string>"
      }
    },
    "user": {
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "name": "<string>",
      "avatar": "<string>"
    },
    "crm_marketing_lead_source": [
      {}
    ]
  },
  "crm_person": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "name": "<string>"
  }
}

Authorizations

Authorization
string
header
required

Utilize o token de integração no header Authorization: Bearer {token}. O domínio de origem (Origin/Referer) deve respeitar allowed_domain, quando configurado na chave.

Body

application/json
whatsapp_phone_id
string<uuid>
required
wa_contact_id
string
required
Maximum string length: 50
template
object
required
person_contact_id
string<uuid>
remote_profile_name
string | null
Maximum string length: 255
crm_person_id
string<uuid> | null
assigned_agent_id
string<uuid> | null
status
enum<string>
Available options:
OPEN,
RESOLVED,
SNOOZED
template_fields
object[]

Response

Chat criado ou reaproveitado com sucesso.

id
string<uuid>
wa_contact_id
string
contact_name
string
contact_number
string
status
enum<string>
Available options:
OPEN,
RESOLVED,
SNOOZED
chat_type
enum<string>
Available options:
INDIVIDUAL,
GROUP
unread_count
integer
is_manually_unread
boolean
priority
enum<integer>

0 = baixa, 1 = normal, 2 = alta, 3 = urgente.

Available options:
0,
1,
2,
3
archived_at
string<date-time> | null
assigned_agent_id
string<uuid> | null
phone_number
object
assigned_agent
object
last_message_at
string<date-time> | null
last_message
object
crm_person
object