Skip to content

teamwire_api/events

Events

class Events(Enum)

Chat Event

NEW_MESSAGE

Event triggered when a new message arrives to a chat that the bot is subscribed to. The event handler is called with a Message object as extra parameter.

MESSAGE_READ

Event triggered when someone has read the latest messages in a chat. The extra argument will contain a MessageReadInfo object with the following attributes:

  • chat: Chat object. The chat this event refers to
  • user: User object. The user who read the message
  • message_id: unicode. The id of the last read message
  • read_date: datetime. When the message has been read

MESSAGE_DELETED

Event triggered when a message gets deleted by the sender. The extra argument will contain a MessageDeletedInfo object with the following attributes:

  • chat: Chat object. The chat this event refers to
  • message_id: unicode. The id of the deleted message

CHAT_CREATED

Event triggered when a new chat is created. The extra argument will contain a ChatChangeInfo object with the following attributes:

  • chat: Chat object. The chat this event refers to
  • title: (string - the title of the new chat)

CHAT_JOINED

Event triggered when the bot is added to a chat. The extra argument will contain a ChatMemberChangeInfo object with the following attributes:

  • chat: Chat object. The chat this event refers to
  • users: list of User. The bot user that joined the chat
  • circles: not meaningful for this event; present only because ChatMemberChangeInfo is reused, currently empty
  • editor: User object representing the user who added the bot to the chat

CHAT_MEMBERS_ADDED

Event triggered when direct users, circles or roles are added to a chat. The extra argument will contain a ChatMemberChangeInfo object with the following attributes:

  • chat: Chat object. The chat this event refers to
  • users: list of User. The users who were added to the chat
  • circles: list of Group. The circles that were added to the chat
  • roles: list of Role. The roles that were added to the chat
  • editor: User object representing the user who added the member(s)

CHAT_MEMBERS_REMOVED

Event triggered when direct users, circles or roles are removed from a chat. The extra argument will contain a ChatMemberChangeInfo object with the following attributes:

  • chat: Chat object. The chat this event refers to
  • users: list of User. The users who were removed from the chat
  • circles: list of Group. The circles that were removed from the chat
  • roles: list of Role. The roles that were removed from the chat
  • editor: User object representing the user who removed the member(s)

CIRCLE_USERS_ADDED

Event triggered when users are added to a circle that is a member of a chat. The extra argument will contain a CircleMemberUpdateInfo object with the following attributes:

  • chat: Chat object. The chat this event refers to
  • users: list of User. The users who were added to the circle
  • circles: list of Group. The circle that received the users
  • editor: User object representing the user who added the users

CIRCLE_USERS_REMOVED

Event triggered when users are removed from a circle that is a member of a chat. The extra argument will contain a CircleMemberUpdateInfo object with the following attributes:

  • chat: Chat object. The chat this event refers to
  • users: list of User. The users who were removed from the circle
  • circles: list of Group. The circle that lost the users
  • editor: User object representing the user who removed the users

CIRCLES_DELETED

Event triggered when circles are deleted and removed from a chat. The extra argument will contain a ChatMemberChangeInfo object with the following attributes:

  • chat: Chat object. The chat this event refers to
  • users: empty list
  • circles: list of Group. The deleted circles that were removed from the chat
  • editor: User object representing the user who deleted the circles, if available

ROLES_JOINED

Event triggered when a user joins one or more roles in a chat. The extra argument will contain a ChatMemberChangeInfo object with the following attributes:

  • chat: Chat object. The chat this event refers to
  • users: list of User. The user who joined the roles
  • roles: list of Role. The roles joined by the user
  • editor: User object representing the user who performed the operation

ROLES_LEFT

Event triggered when a user leaves one or more roles in a chat. The extra argument will contain a ChatMemberChangeInfo object with the following attributes:

  • chat: Chat object. The chat this event refers to
  • users: list of User. The user who left the roles
  • roles: list of Role. The roles left by the user
  • editor: User object representing the user who performed the operation

ROLE_USERS_REMOVED

Event triggered when users are removed from a role in a chat. The extra argument will contain a ChatMemberChangeInfo object with the following attributes:

  • chat: Chat object. The chat this event refers to
  • users: list of User. The users removed from the role
  • roles: list of Role. The affected roles, if available
  • editor: User object representing the user who performed the operation, if available

ROLES_DELETED

Event triggered when roles are deleted and removed from a chat. The extra argument will contain a ChatMemberChangeInfo object with the following attributes:

  • chat: Chat object. The chat this event refers to
  • users: empty list
  • roles: list of Role. The deleted roles removed from the chat
  • editor: User object representing the user who deleted the roles, if available

CHAT_DELETED

Event triggered when the bot is removed from a chat. The extra argument will contain a ChatMemberChangeInfo object with the following attributes:

  • chat: Chat object. The chat this event refers to
  • users: list of User. The bot user that was removed from the chat
  • circles: empty list
  • editor: User object representing the user who removed the bot from the chat

CHAT_TITLE_CHANGED

Event triggered when the title of the chat has been changed. The extra argument will contain a ChatChangeInfo object with the following attributes:

  • chat: Chat object. The chat this event refers to
  • title: string. The new title of the chat
  • editor: User object representing the user who performed the operation

CHAT_ADMINS_CHANGED

Event triggered when the administrators list of the chat has been changed. The extra argument will contain a ChatChangeInfo object with the following attributes:

  • chat: Chat object. The chat this event refers to
  • added_admins: list of User objects. The users who were made chat administrators
  • removed_admins: list of User objects. The users who were removed from the administrators list
  • editor: User object representing the user who performed the operation

CHAT_ALLOW_SENDING_CHANGED

Event triggered when the allow_sending property of the chat has been changed. The extra argument will contain a ChatChangeInfo object with the following attributes:

  • chat: Chat object. The chat this event refers to
  • allow_sending: boolean. Whether other members of the chat can send messages
  • editor: User object representing the user who performed the operation

CHAT_IS_CLOSED_CHANGED

Event triggered when the is_closed property of the chat has been changed. The extra argument will contain a ChatChangeInfo object with the following attributes:

  • chat: Chat object. The chat this event refers to
  • is_closed: boolean. Whether the chat has been closed
  • editor: User object representing the user who performed the operation

ConnectionEvents

class ConnectionEvents(Enum)

Backend connectivity Event

BACKEND_CONNECTED

Event triggered when the bot is connected to the backend notifications service

BACKEND_DISCONNECTED

Event triggered when the bot has been disconnected from the backend notifications service (e.g. for network connectivity issues)