Contacts¶
Create, search, and manage contacts and their labels.
ContactsResource ¶
Bases: BaseResource
Synchronous contacts resource.
Initialize contacts resource with nested labels resource.
list ¶
search ¶
get ¶
Get contact details.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
int
|
The account ID |
required |
contact_id
|
int
|
The contact ID |
required |
Returns:
| Type | Description |
|---|---|
Contact
|
Contact object |
Examples:
create ¶
Create a new contact.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
int
|
The account ID |
required |
inbox_id
|
int
|
The inbox ID to associate contact with |
required |
**kwargs
|
Any
|
Contact attributes (name, email, phone_number, etc.) |
{}
|
Returns:
| Type | Description |
|---|---|
ContactCreateResponse
|
ContactCreateResponse with contact and contact_inbox |
Examples:
update ¶
Update contact.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
int
|
The account ID |
required |
contact_id
|
int
|
The contact ID |
required |
**kwargs
|
Any
|
Contact attributes to update |
{}
|
Returns:
| Type | Description |
|---|---|
Contact
|
Updated Contact object |
Examples:
delete ¶
conversations ¶
Get contact conversations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
int
|
The account ID |
required |
contact_id
|
int
|
The contact ID |
required |
Returns:
| Type | Description |
|---|---|
list[Conversation]
|
List of Conversation objects for this contact |
Examples:
merge ¶
Merge two contacts. The mergee is deleted; the base contact is kept.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
int
|
The account ID |
required |
base_contact_id
|
int
|
ID of the contact that remains after the merge |
required |
mergee_contact_id
|
int
|
ID of the contact that is merged in and deleted |
required |
Returns:
| Type | Description |
|---|---|
Contact
|
The resulting merged Contact object |
Examples:
ContactLabelsResource ¶
Bases: BaseResource
Nested resource for managing contact labels.
list ¶
List contact labels.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
int
|
The account ID |
required |
contact_id
|
int
|
The contact ID |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
List of label strings |
Examples:
add ¶
Add/replace labels on contact.
IMPORTANT: This overwrites existing labels, does not append.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
int
|
The account ID |
required |
contact_id
|
int
|
The contact ID |
required |
labels
|
list[str]
|
List of label strings to set |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Updated list of labels |
Examples:
AsyncContactsResource ¶
Bases: AsyncBaseResource
Asynchronous contacts resource.
Initialize async contacts resource with nested labels resource.
list
async
¶
search
async
¶
get
async
¶
Get contact details (async).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
int
|
The account ID |
required |
contact_id
|
int
|
The contact ID |
required |
Returns:
| Type | Description |
|---|---|
Contact
|
Contact object |
create
async
¶
Create a new contact (async).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
int
|
The account ID |
required |
inbox_id
|
int
|
The inbox ID |
required |
**kwargs
|
Any
|
Contact attributes |
{}
|
Returns:
| Type | Description |
|---|---|
ContactCreateResponse
|
ContactCreateResponse with contact and contact_inbox |
update
async
¶
Update contact (async).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
int
|
The account ID |
required |
contact_id
|
int
|
The contact ID |
required |
**kwargs
|
Any
|
Contact attributes to update |
{}
|
Returns:
| Type | Description |
|---|---|
Contact
|
Updated Contact object |
delete
async
¶
Delete contact (async).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
int
|
The account ID |
required |
contact_id
|
int
|
The contact ID |
required |
conversations
async
¶
Get contact conversations (async).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
int
|
The account ID |
required |
contact_id
|
int
|
The contact ID |
required |
Returns:
| Type | Description |
|---|---|
list[Conversation]
|
List of Conversation objects |
merge
async
¶
Merge two contacts (async). The mergee is deleted; the base is kept.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
int
|
The account ID |
required |
base_contact_id
|
int
|
ID of the contact that remains after the merge |
required |
mergee_contact_id
|
int
|
ID of the contact that is merged in and deleted |
required |
Returns:
| Type | Description |
|---|---|
Contact
|
The resulting merged Contact object |
AsyncContactLabelsResource ¶
Bases: AsyncBaseResource
Async nested resource for managing contact labels.
list
async
¶
List contact labels (async).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
int
|
The account ID |
required |
contact_id
|
int
|
The contact ID |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
List of label strings |
add
async
¶
Add/replace labels on contact (async).
IMPORTANT: This overwrites existing labels, does not append.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
int
|
The account ID |
required |
contact_id
|
int
|
The contact ID |
required |
labels
|
list[str]
|
List of label strings to set |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Updated list of labels |