Messages

Pachca.get_messages(chat_id: int, sort_field: Literal['id'] = 'id', sort_direction: Literal['asc', 'desc'] = 'desc') list[dict]

Gets available messages according to https://crm.pachca.com/dev/messages/list/

Parameters:
  • chat_id (int) – Chat ID.

  • sort_field (str) – Sort field: ‘id’ or ‘last_message_at’.

  • sort_direction (str) – Sort direction: ‘asc’ or ‘desc’.

Returns:

List of messages.

Return type:

list[dict]

Pachca.get_message(message_id: int) dict

Get message info.

Parameters:

message_id (int) – message ID.

Returns:

Message dict.

Return type:

dict

Pachca.create_message(entity_id: int, content: str, entity_type: Literal['discussion', 'user', 'thread'] = 'discussion', parent_message_id: int | None = None, display_avatar_url: str | None = None, display_name: str | None = None, skip_invite_mentions: bool = False, link_preview: bool = False, files: list[File] | None = None) dict

Create message (for discussion, thread and user chat types).

Parameters:
  • entity_id (int) – ID of target entity (chat ID, thread ID, user ID).

  • content (str) – Message content.

  • entity_type (str) – Type of target entity: discussion, user, thread.

  • parent_message_id (int, optional) – Reply to message ID.

  • display_avatar_url (str, optional) – URL of avatar (only for bot).

  • display_name (str, optional) – Name of message author (only for bot).

  • skip_invite_mentions (bool) – True will invite mentioned users to thread (only for threads).

  • link_preview (bool) – Display first link preview or not.

  • files (list[File]) – Optional list of File objects.

Returns:

Created message dict.

Return type:

dict

Pachca.update_message(message_id: int, content: str) dict

Update message.

Parameters:
  • message_id (int) – Message ID.

  • content (str) – Content to update.

Returns:

Updated message dict.

Return type:

dict

Pachca.pin_message(message_id: int) dict

Pin message.

Parameters:

message_id (int) – message ID.

Returns:

Message dict.

Return type:

dict

Pachca.unpin_message(message_id: int) dict

Unpin message.

Parameters:

message_id (int) – message ID.

Returns:

Message dict.

Return type:

dict

Pachca.create_thread(message_id: int) dict

Create new thread for message.

Parameters:

message_id (int) – Message ID, where we want to create thread.

Returns:

Thread parameters.

Return type:

dict

Pachca.get_thread(thread_id: int) dict

Get thread information.

Parameters:

thread_id (int) – Thread ID.

Returns:

Thread parameters.

Return type:

dict