wxc_sdk.messages package

Messages API

class wxc_sdk.messages.AdaptiveCardAction(*, type: str | None = None, url: str | None = None, title: str | None = None)[source]

Bases: ApiModel

type: str | None

Action.OpenUrl

Type:

Possible values

url: str | None

//adaptivecards.io

Type:

Possible values

Type:

http

title: str | None

Learn More

Type:

Possible values

class wxc_sdk.messages.AdaptiveCard(*, type: str | None = None, version: str | None = None, body: list[AdaptiveCardBody] | None = None, actions: list[AdaptiveCardAction] | None = None)[source]

Bases: ApiModel

type: str | None

Must be AdaptiveCard.

version: str | None

Adaptive Card schema version.

body: list[AdaptiveCardBody] | None

The card’s elements.

actions: list[AdaptiveCardAction] | None

The card’s actions.

class wxc_sdk.messages.MessageAttachment(*, contentType: str | None = None, content: AdaptiveCard | None = None)[source]

Bases: ApiModel

content_type: str | None

The content type of the attachment.

content: AdaptiveCard | None

Adaptive Card content.

class wxc_sdk.messages.AdaptiveCardBody(*, type: str | None = None, text: str | None = None, size: str | None = None)[source]

Bases: ApiModel

type: str | None

TextBlock

Type:

Possible values

text: str | None

Adaptive Cards

Type:

Possible values

size: str | None

large

Type:

Possible values

class wxc_sdk.messages.Message(*, id: str | None = None, parentId: str | None = None, roomId: str | None = None, roomType: RoomType | None = None, text: str | None = None, markdown: str | None = None, html: str | None = None, files: list[str] | None = None, personId: str | None = None, personEmail: str | None = None, toPersonId: str | None = None, toPersonEmail: str | None = None, mentionedPeople: list[str] | None = None, mentionedGroups: list[str] | None = None, attachments: list[MessageAttachment] | None = None, created: datetime | None = None, updated: datetime | None = None, isVoiceClip: bool | None = None)[source]

Bases: ApiModel

id: str | None

The unique identifier for the message.

parent_id: str | None

The unique identifier for the parent message.

room_id: str | None

The room ID of the message.

room_type: RoomType | None

The type of room.

text: str | None

The message, in plain text. If markdown is specified this parameter may be optionally used to provide alternate text for UI clients that do not support rich text. The maximum message length is 7439 bytes.

markdown: str | None

The message, in Markdown format. If this attribute is set ensure that the request does NOT contain an html attribute.

html: str | None

The text content of the message, in HTML format. This read-only property is used by the Webex clients.

files: list[str] | None

Public URLs for files attached to the message. For the supported media types and the behavior of file uploads, see Message Attachments.

person_id: str | None

The person ID of the message author.

person_email: str | None

The email address of the message author.

to_person_id: str | None

1 message.

Type:

The person ID of the recipient when sending a private 1

to_person_email: str | None

1 message.

Type:

The email address of the recipient when sending a private 1

mentioned_people: list[str] | None

People IDs for anyone mentioned in the message.

mentioned_groups: list[str] | None

Group names for the groups mentioned in the message.

attachments: list[MessageAttachment] | None

Message content attachments attached to the message. See the Cards Guide for more information.

created: datetime | None

The date and time the message was created.

updated: datetime | None

The date and time that the message was last edited by the author. This field is only present when the message contents have changed.

is_voice_clip: bool | None

true if the audio file is a voice clip recorded by the client; false if the audio file is a standard audio file not posted using the voice clip feature.

class wxc_sdk.messages.MessagesData(*, id: str, roomId: str, roomType: RoomType | None = None, personId: str | None = None, personEmail: str | None = None, created: datetime | None = None, **extra_data: Any)[source]

Bases: WebhookEventData

Data in a webhook “messages” event

resource: ClassVar = 'messages'
id: str
room_id: str
room_type: RoomType | None
person_id: str | None
person_email: str | None
created: datetime | None
class wxc_sdk.messages.MessagesApi(*, session: RestSession, base: str | None = None)[source]

Bases: ApiChild

list(room_id: str, parent_id: str | None = None, mentioned_people: List[str] | None = None, before: datetime | None = None, before_message: str | None = None, **params) Generator[Message, None, None][source]

Lists all messages in a room. Each message will include content attachments if present. The list sorts the messages in descending order by creation date. Long result sets will be split into pages.

Parameters:
  • room_id (str) – List messages in a room, by ID.

  • parent_id (str) – List messages with a parent, by ID.

  • mentioned_people (List[str]) – List messages with these people mentioned, by ID. Use me as a shorthand for the current API user. Only me or the person ID of the current user may be specified. Bots must include this parameter to list messages in group rooms (spaces).

  • before (str) – List messages sent before a date and time.

  • before_message (str) – List messages sent before a message, by ID.

list_direct(parent_id: str | None = None, person_id: str | None = None, person_email: str | None = None, **params) Generator[Message, None, None][source]

List all messages in a 1:1 (direct) room. Use the personId or personEmail query parameter to specify the room. Each message will include content attachments if present. The list sorts the messages in descending order by creation date.

Parameters:
  • parent_id (str) – List messages with a parent, by ID.

  • person_id (str) – List messages in a 1:1 room, by person ID.

  • person_email (str) – List messages in a 1:1 room, by person email.

create(room_id: str | None = None, parent_id: str | None = None, to_person_id: str | None = None, to_person_email: str | None = None, text: str | None = None, markdown: str | None = None, html: str | None = None, files: List[str] | None = None, attachments: List[dict | MessageAttachment] | None = None) Message[source]

Post a plain text, rich text or html message, and optionally, a file attachment, to a room.

The files parameter is an array, which accepts multiple values to allow for future expansion, but currently only one file may be included with the message. File previews are only rendered for attachments of 1MB or less.

html formatting is limited to the following markup h1,h2,h3,ul,ol,u,i,b and links.

Parameters:
  • room_id (str) – The room ID of the message.

  • parent_id (str) – The parent message to reply to.

  • to_person_id (str) – The person ID of the recipient when sending a private 1:1 message.

  • to_person_email (str) – The email address of the recipient when sending a private 1:1 message.

  • text (str) – The message, in plain text. If markdown is specified this parameter may be optionally used to provide alternate text for UI clients that do not support rich text. The maximum message length is 7439 bytes.

  • markdown (str) – The message, in Markdown format. The maximum message length is 7439 bytes.

  • html (str) – The message, in HTML format. The maximum message length is 7439 bytes.

  • files (List[str]) – The public URL to a binary file or a path to a local file to be posted into the room. Only one file is allowed per message. Uploaded files are automatically converted into a format that all Webex clients can render. For the supported media types and the behavior of uploads, see the Message Attachments Guide.

  • attachments (List[Attachment]) – Content attachments to attach to the message. Only one card per message is supported. See the Cards Guide for more information.

Return type:

Message

edit(message: Message) Message[source]

Update a message you have posted not more than 10 times. Specify the messageId of the message you want to edit. Edits of messages containing files or attachments are not currently supported. If a user attempts to edit a message containing files or attachments a 400 Bad Request will be returned by the API with a message stating that the feature is currently unsupported. There is also a maximum number of times a user can edit a message. The maximum currently supported is 10 edits per message. If a user attempts to edit a message greater that the maximum times allowed the API will return 400 Bad Request with a message stating the edit limit has been reached. While only the roomId and text or markdown attributes are required in the request body, a common pattern for editing message is to first call GET /messages/{id} for the message you wish to edit and to then update the text or markdown attribute accordingly, passing the updated message object in the request body of the PUT /messages/{id} request.

Parameters:

message

the updated message, id has to be set in the message attributes supported for update:

  • room_id: str: The room ID of the message.

  • text: str: The message, in plain text. If markdown is specified this parameter may be optionally used to provide alternate text for UI clients that do not support rich text. The maximum message length is 7439 bytes.

  • markdown: str: The message, in Markdown format. If this attribute is set ensure that the request does NOT contain an html attribute.

  • html: str: The message, in HTML format. The maximum message length is 7439 bytes.

details(message_id: str) Message[source]

Show details for a message, by message ID. Specify the message ID in the messageId parameter in the URI.

Parameters:

message_id (str) – The unique identifier for the message.

delete(message_id: str)[source]

Delete a message, by message ID. Specify the message ID in the messageId parameter in the URI.

Parameters:

message_id (str) – The unique identifier for the message.

base = 'messages'