Files

91 lines
2.4 KiB
YAML

get:
tags:
- Contacts
operationId: contactList
description: Listing all the resolved contacts with pagination (Page size = 15). Resolved contacts are the ones with a value for identifier, email or phone number
summary: List Contacts
security:
- userApiKey: []
parameters:
- $ref: '#/components/parameters/account_id'
- $ref: '#/components/parameters/contact_sort_param'
- $ref: '#/components/parameters/page'
x-codeSamples:
- lang: python
label: "List all contacts"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
contacts = client.contacts.list(account_id=1, page=1)
for contact in contacts:
print(contact.name, contact.email)
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/contacts_list_response'
'400':
description: Bad Request Error
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'
post:
tags:
- Contacts
operationId: contactCreate
description: Create a new Contact
summary: Create Contact
security:
- userApiKey: []
parameters:
- $ref: '#/components/parameters/account_id'
x-codeSamples:
- lang: python
label: "Create a contact"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
result = client.contacts.create(
account_id=1,
inbox_id=5,
name="John Doe",
email="john@example.com",
phone_number="+1234567890"
)
print(result.contact.id, result.contact_inbox.source_id)
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/contact_create_payload'
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/extended_contact'
'400':
description: Bad Request Error
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'