teamwire_api.events¶
Events¶
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:Chatobject. The chat this event refers touser:Userobject. The user who read the messagemessage_id: unicode. The id of the last read messageread_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:Chatobject. The chat this event refers tomessage_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(theChatobject representing the new chat)title(string - the title of the new chat)
CHAT_JOINED¶
Event triggered when another user joins the chat. The extra argument will contain a ChatMemberChangeInfo object with the following attributes:
chat(theChatobject)users(list of users that joined the chat)editor(Userobject representing the user who invited the other user(s) to the chat)
CHAT_LEFT¶
Event triggered when some user leaves the chat. The extra argument will contain a ChatMemberChangeInfo object with the following attributes:
chat(theChatobject)users(list of users that left the chat)editor(Userobject representing the user who removed the other user(s) from the chat)
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(theChatobject)users(list of users (including the bot's user) that were removed from the chat)editor(Userobject representing the user who removed the other user(s) 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(theChatobject)title(the new title of the chat)editor(Userobject 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(theChatobject)added_admins(list of users that were made chat administrators)removed_admins(list of users that were removed from the administrators)editor(Userobject 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(theChatobject)allow_sending(boolean. Whether other members of the chat can send messages)editor(Userobject representing the user who performed the operation)
CHAT_ALLOW_MUTE_NOTIFICATIONS_CHANGED¶
Event triggered when the allow_mute_notifications property of the chat has been changed. The extra argument will contain a ChatChangeInfo object with the following attributes:
chat(theChatobject)allow_mute_notifications(boolean. Whether members of the chat can mute notifications)editor(Userobject 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(theChatobject)is_closed(boolean. Whether the chat has been closed)editor(Userobject representing the user who performed the operation)
ConnectionEvents¶
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)