60 lines
1.7 KiB
YAML
60 lines
1.7 KiB
YAML
get:
|
|
tags:
|
|
- Contacts
|
|
operationId: contactSearch
|
|
description: Search the resolved contacts using a search key, currently supports email search (Page size = 15). Resolved contacts are the ones with a value for identifier, email or phone number
|
|
summary: Search Contacts
|
|
security:
|
|
- userApiKey: []
|
|
parameters:
|
|
- $ref: '#/components/parameters/account_id'
|
|
- name: q
|
|
in: query
|
|
schema:
|
|
type: string
|
|
description: Search using contact `name`, `identifier`, `email` or `phone number`
|
|
- $ref: '#/components/parameters/contact_sort_param'
|
|
- $ref: '#/components/parameters/page'
|
|
x-codeSamples:
|
|
- lang: python
|
|
label: "Search by email"
|
|
source: |
|
|
from chatwoot import ChatwootClient
|
|
|
|
client = ChatwootClient(
|
|
base_url="https://app.chatwoot.com",
|
|
api_token="your-api-token"
|
|
)
|
|
|
|
contacts = client.contacts.search(
|
|
account_id=1,
|
|
query="john@example.com"
|
|
)
|
|
|
|
for contact in contacts:
|
|
print(contact.name, contact.email)
|
|
- lang: python
|
|
label: "Search by name"
|
|
source: |
|
|
from chatwoot import ChatwootClient
|
|
|
|
client = ChatwootClient(
|
|
base_url="https://app.chatwoot.com",
|
|
api_token="your-api-token"
|
|
)
|
|
|
|
contacts = client.contacts.search(account_id=1, query="John Doe")
|
|
responses:
|
|
'200':
|
|
description: Success
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/contacts_list_response'
|
|
'401':
|
|
description: Authentication error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/bad_request_error'
|