Skip to content

Types API

JID

JID(user: str, server: str)

Represents a WhatsApp JID (user + server).

Create a JID from user and server parts.

Source code in python/tryx/types.py
- :class:`UploadResponse`  Media upload response from WhatsApp servers.

Example::

Methods:

MessageSource

Describes where a message came from and who it targets.

MessageInfo

Normalized metadata for a received or sent message.

Attributes

source property

source: MessageSource

Return the message source (sender, chat, is_from_me).

RETURNS DESCRIPTION
MessageSource

MessageSource with sender and chat JIDs.

multicast property

multicast: bool

Return True if the message was sent to multiple recipients.

RETURNS DESCRIPTION
bool

Boolean flag.

server_id property

server_id: int

Return the server-assigned message ID.

RETURNS DESCRIPTION
int

Server ID integer.

timestamp property

timestamp: datetime

Return the message timestamp.

RETURNS DESCRIPTION
datetime

datetime of the message.

media_type property

media_type: str

Return the media type string (e.g. 'image', 'video').

RETURNS DESCRIPTION
str

Media type string.

edit property

edit: str

Return the edit status string, or None.

RETURNS DESCRIPTION
str

Edit string or None.

bot_info property

bot_info: MsgBotInfo | None

Return bot edit metadata, or None.

RETURNS DESCRIPTION
MsgBotInfo | None

MsgBotInfo or None.

meta_info property

meta_info: MsgMetaInfo

Return additional message metadata.

RETURNS DESCRIPTION
MsgMetaInfo

MsgMetaInfo with target_id, content_type, etc.

verified_name property

verified_name: VerifiedNameCertificate | None

Return the verified name certificate, or None.

RETURNS DESCRIPTION
VerifiedNameCertificate | None

VerifiedNameCertificate or None.

device_sent_meta property

device_sent_meta: DeviceSentMeta | None

Return device-sent metadata, or None.

RETURNS DESCRIPTION
DeviceSentMeta | None

DeviceSentMeta or None.

category property

category: str

Return the message category string.

RETURNS DESCRIPTION
str

Category string (e.g. 'message').

ephemeral_expiration property

ephemeral_expiration: int | None

Return the ephemeral expiration timer in seconds, or None.

RETURNS DESCRIPTION
int | None

Expiration seconds or None.

is_offline property

is_offline: bool

Return True if the message was sent while offline.

RETURNS DESCRIPTION
bool

Boolean flag.

unavailable_request_id property

unavailable_request_id: str | None

Return the unavailable request ID, or None.

RETURNS DESCRIPTION
str | None

Request ID string or None.

server_timestamp_us property

server_timestamp_us: int | None

Return the server timestamp in microseconds, or None.

RETURNS DESCRIPTION
int | None

Microsecond timestamp or None.

verified_level property

verified_level: str | None

Return the verified level string, or None.

RETURNS DESCRIPTION
str | None

Level string or None.

verified_name_serial property

verified_name_serial: int | None

Return the verified name serial number, or None.

RETURNS DESCRIPTION
int | None

Serial integer or None.

peer_recipient_pn property

peer_recipient_pn: JID | None

Return the peer recipient phone JID, or None.

RETURNS DESCRIPTION
JID | None

JID or None.

bcl_participants property

bcl_participants: list[JID]

Return the broadcast list participant JIDs.

RETURNS DESCRIPTION
list[JID]

List of JID objects.

SendResult

Result metadata for send operations.

Attributes

message_id property

message_id: str

Return the server-assigned message ID.

RETURNS DESCRIPTION
str

Message ID string.

to property

to: JID

Return the recipient JID.

RETURNS DESCRIPTION
JID

Recipient JID.

UploadResponse

Result of a media upload call.

Attributes

url property

url: str

Return the upload URL.

RETURNS DESCRIPTION
str

URL string.

direct_path property

direct_path: str

Return the direct download path.

RETURNS DESCRIPTION
str

Direct path string.

media_key property

media_key: bytes

Return the media encryption key.

RETURNS DESCRIPTION
bytes

Media key bytes.

file_enc_sha256 property

file_enc_sha256: bytes

Return the encrypted file SHA-256 hash.

RETURNS DESCRIPTION
bytes

SHA-256 hash bytes.

file_sha256 property

file_sha256: bytes

Return the plaintext file SHA-256 hash.

RETURNS DESCRIPTION
bytes

SHA-256 hash bytes.

file_length property

file_length: int

Return the file size in bytes.

RETURNS DESCRIPTION
int

File length integer.

media_key_timestamp property

media_key_timestamp: int

Return the media key timestamp.

RETURNS DESCRIPTION
int

Timestamp integer.

streaming_sidecar property

streaming_sidecar: bytes | None

Return the streaming sidecar bytes, or None.

RETURNS DESCRIPTION
bytes | None

Sidecar bytes or None.

MediaReuploadResult

Result of media reupload request.

Attributes

status property

status: str

Return the reupload status string.

RETURNS DESCRIPTION
str

Status string (e.g. 'ok').

direct_path property

direct_path: str | None

Return the new direct path, or None.

RETURNS DESCRIPTION
str | None

Direct path string or None.

ProfilePicture

Metadata about a user's profile picture.

MsgBotInfo

Bot edit metadata attached to a message.

Attributes

edit_type property

edit_type: Literal['First', 'Inner', 'Last'] | None

Return the edit type ('First', 'Inner', 'Last'), or None.

RETURNS DESCRIPTION
Literal['First', 'Inner', 'Last'] | None

Edit type string or None.

edit_target_id property

edit_target_id: str | None

Return the edit target message ID, or None.

RETURNS DESCRIPTION
str | None

Target message ID string or None.

edit_sender_timestamp property

edit_sender_timestamp: int | None

Return the edit sender timestamp, or None.

RETURNS DESCRIPTION
int | None

Timestamp integer or None.

MsgMetaInfo

Additional metadata attached to a message payload.

Attributes

target_id property

target_id: str | None

Return the target message ID, or None.

RETURNS DESCRIPTION
str | None

Target message ID string or None.

target_sender property

target_sender: JID | None

Return the target sender JID, or None.

RETURNS DESCRIPTION
JID | None

Target sender JID or None.

target_chat property

target_chat: JID | None

Return the target chat JID, or None.

RETURNS DESCRIPTION
JID | None

Target chat JID or None.

deprecated_lid_session property

deprecated_lid_session: bool | None

Return deprecated LID session flag, or None.

RETURNS DESCRIPTION
bool | None

Boolean or None.

thread_message_id property

thread_message_id: str | None

Return the thread message ID, or None.

RETURNS DESCRIPTION
str | None

Thread message ID string or None.

thread_message_sender_jid property

thread_message_sender_jid: JID | None

Return the thread message sender JID, or None.

RETURNS DESCRIPTION
JID | None

Sender JID or None.

content_type property

content_type: str | None

Return the content type string, or None.

RETURNS DESCRIPTION
str | None

Content type string or None.

appdata property

appdata: str | None

Return the app data string, or None.

RETURNS DESCRIPTION
str | None

App data string or None.

reporting_tag property

reporting_tag: bytes | None

Return the reporting tag bytes, or None.

RETURNS DESCRIPTION
bytes | None

Raw bytes or None.

reporting_token property

reporting_token: bytes | None

Return the reporting token bytes, or None.

RETURNS DESCRIPTION
bytes | None

Raw bytes or None.

reporting_token_version property

reporting_token_version: int | None

Return the reporting token version, or None.

RETURNS DESCRIPTION
int | None

Version integer or None.

DeviceSentMeta

Metadata used for device-sent message synchronization.

Attributes

destination_jid property

destination_jid: str

Return the destination JID string.

RETURNS DESCRIPTION
str

Destination JID string.

phash property

phash: str

Return the phone hash string.

RETURNS DESCRIPTION
str

Phone hash string.


Core value objects in tryx.types define identity, message metadata, and result contracts used across client namespaces.

Identity and Source Types

JID

Canonical WhatsApp identifier:

  • user: account or group numeric/opaque id
  • server: domain segment (s.whatsapp.net, g.us, etc.)

MessageSource

Routing context for a message:

  • sender identity
  • target chat identity
  • from-me and group flags
  • alternate identity hints for multi-device routing

MessageInfo

Message metadata envelope:

  • id
  • type
  • timestamp
  • source
  • edit and verification metadata

Send and Media Result Types

Type Produced by
UploadResponse upload, upload_file
SendResult send_* methods
MediaReuploadResult request_media_reupload
ProfilePicture client.contact.get_profile_picture

Advanced Metadata Types

  • MsgBotInfo
  • MsgMetaInfo
  • DeviceSentMeta

These are useful when building sync-aware systems and diagnostics.

Practical Typed Patterns

from tryx.events import EvMessage
from tryx.types import JID


def source_chat(event: EvMessage) -> JID:
    return event.data.message_info.source.chat
async def send_with_audit(client, chat, text):
    result = await client.send_text(chat, text)
    return {"message_id": result.id, "ts": result.timestamp}

Privacy Type Bridge

Privacy and status workflows (documented in Privacy Namespace and Status Namespace) rely on typed enums from the client surface, including:

  • PrivacyCategory
  • PrivacyValue
  • DisallowedListAction
  • StatusPrivacySetting

Type-first architecture

Keep handler boundaries typed. Convert external payloads into typed objects early, and keep business logic free of ad-hoc dict parsing.