PubSub Events

Accounts

class accounts.events.JoinedOrganization(dt, user, organization)
Returns

  • user (Object) - user object
    • id (int) - user ID

    • username (string)

    • firstName (string)

    • lastName (string)

    • displayName (string)

    • email (string)

    • avatar (string) - URL to the user’s avatar

    • is_only_invited `` *(bool)* - ``true if user has not signed up

    • what_i_do (string)

    • skype_username (string)

    • hide_email_field (boolean)

    • phone_number (string)

  • organization (int) - organization id

  • event organization.joined

  • time (string) - ISO8601 timestamp

Return type

Object

name = 'joined'
ns = 'organization'
class accounts.events.LeftOrganization(dt, user_id, organization_id: int)
Returns

  • user (int) - user id

  • organization (int) - organization id

  • event organization.left

  • time (string) - ISO8601 timestamp

Return type

Object

name = 'left'
ns = 'organization'
pubsub_channel_template = 'organization:{organization}'
class accounts.events.UpdatedMembership(membership)
Returns

  • membership (Object) - membership object
    • user (int) - user id

    • deleted (string) - ISO8601 timestamp

    • organization (int) - organization id

    • role (int) - role within organization:
      • 0: regular user

      • 1: admin

      • 2: organization owner

    • title (string)

  • event membership.updated

  • time (string) - ISO8601 timestamp

Return type

Object

name = 'updated'
ns = 'membership'
class accounts.events.UpdatedOrganization(organization)

Gets fired when somebody changes the organization settings.

Returns

  • organization (Object) - organization object
    • id (int) - organization id

    • name (string)

    • subdomain (string)

    • logo (string) - URL to the organization’s logo, if set

    • custom_emojis (Object) - emoji-name (string) –> image-url (string)

    • inviter_role

    • message_edit_timeout (int)

Return type

Object

name = 'updated'
ns = 'organization'
class accounts.events.UpdatedUser(user)
Returns

  • user (Object) - user object
    • id (int) - user ID

    • username (string)

    • firstName (string)

    • lastName (string)

    • displayName (string)

    • email (string)

    • avatar (string) - URL to the user’s avatar

    • is_only_invited `` *(bool)* - ``true if user has not signed up

    • what_i_do (string)

    • skype_username (string)

    • hide_email_field (boolean)

    • phone_number (string)

  • event user.updated

  • time (string) - ISO8601 timestamp

Return type

Object

name = 'updated'
ns = 'user'

Chat

class chat.events.Joined(channelmember)

This event is triggered when a user joins a channel.

Returns

  • event channel.joined

  • time (string) - ISO8601 timestamp

  • channel_data (object) - data related to the channel

  • user_data (object) - data related to the channel

  • organization_id (int) - organization ID

  • user (int) - user id (deprecated)

  • channel (int) - channel id (deprecated)

Return type

Object

name = 'joined'
ns = 'channel'
class chat.events.LeftChannel(channel, user)
name = 'left'
ns = 'channel'
class chat.events.Mentioned(msg)
Returns

  • all message fields, see get_history()

  • event (string) - user.mentioned

  • time (string) - ISO8601 timestamp

Return type

Object

name = 'mentioned'
ns = 'user'
class chat.events.NewChannel(channel, creator=None)
Returns

  • channel

  • organization_id (int) - organization ID

  • event (string) - channel.new

  • time (string) - ISO8601 timestamp

Return type

Object

name = 'new'
ns = 'channel'
class chat.events.NewMessage(message, channel)
Returns

  • all message fields, see get_history()

  • event message.new

  • time (string) - ISO8601 timestamp

Return type

Object

name = 'new'
ns = 'message'
class chat.events.NewSystemMessage(message, channel)

This event will send only the message metadata necessary to get the message itself. This event is suppose to trigger a call to channels.get_message rpc, that knows how to proper build the message as it know during runtime which user is calling it and in which language.

Returns

  • message_id (int)

  • channel (object)

  • author (object)

  • event system_message.new

  • time (string) - ISO8601 timestamp

Return type

Object

name = 'new'
ns = 'system_message'
class chat.events.PinsChanged(changed, channel)
Returns

  • changed (list) - what was changed

  • organization_id (int) - organization ID

  • event (string) - pins.changed

  • time (string) - ISO8601 timestamp

Return type

Object

name = 'changed'
ns = 'pins'
class chat.events.Read(user_id, msg_id, channel)
Returns

  • message (int) - message id

  • user (int) - user id

  • channel (int) - channel id

  • organization_id (int) - organization ID

  • event channel.read

  • time (string) - ISO8601 timestamp

Return type

Object

name = 'read'
ns = 'channel'
class chat.events.RemovedChannel(channel)
Returns

  • channel

  • organization_id (int) - organization ID

  • event (string) - channel.removed

  • time (string) - ISO8601 timestamp

Return type

Object

name = 'removed'
ns = 'channel'
class chat.events.RemovedMessage(message, channel)
Returns

  • id (int) - message id

  • channel (int) - channel id

  • event message.removed

  • message_time (string) - ISO8601 timestamp of original message

  • time (string) - ISO8601 timestamp

Return type

Object

name = 'removed'
ns = 'message'
class chat.events.StatusChange(user_id: int, status: int, organization_id: int)
Returns

  • status (int) - presence status within the organization
    • 0 Offline

    • 4 Reachable

    • 8 In Call

    • 16 Online

  • user (int) - user id

  • organization_id (int) - organization ID

  • event user.status

  • time (string) - ISO8601 timestamp

Return type

Object

name = 'status'
ns = 'user'
pubsub_channel_template = 'user:{user}:public'
class chat.events.Typing(channel, user, typing: bool)
Returns

  • user (int) - user id - deprecated - this field may be removed by 01.08.2018

  • user_data (object)

    • avatar (string) - the URL for the typing user’s avatar image

    • display_name (string)

    • first_name (string)

    • type (string) - ‘user’ is the only option here for now

    • id (int) - typing user’s ID

  • channel (int) - channel id

  • typing (bool)

  • event channel.typing

  • time (string) - ISO8601 timestamp

Return type

Object

name = 'typing'
ns = 'channel'
class chat.events.UpdatedChannel(channel)
Returns

  • channel

  • organization_id (int) - organization ID

  • event (string) - channel.updated

  • time (string) - ISO8601 timestamp

Return type

Object

name = 'updated'
ns = 'channel'
class chat.events.UpdatedMessage(message, channel)
Returns

  • all message fields, see get_history()

  • event message.updated

  • time (string) - ISO8601 timestamp

Return type

Object

name = 'updated'
ns = 'message'
class chat.events.UpdatedSystemMessage(message_id, channel_id, organization_id)

This event will send only the message metadata necessary to get the updated message itself. This event is suppose to trigger a call to channels.get_message rpc, that knows how to proper build the message as it know during runtime which user is calling it and in which language.

Returns

  • message_id (string) - Message ID

  • channel_id (int) - channel id

  • organization_id (int) - organization id

  • event system_message.updated

  • time (string) - ISO8601 timestamp

Return type

Object

name = 'updated'
ns = 'system_message'
chat.events.get_message_author(message: dict) → int

Returns message’s author id :param message:

Returns

Instant

class instant.events.Event(dt=None, **kwargs)
can_publish()
name = None
ns = None
publish()
pubsub_channel_template = None
serialize()

Notifications

class notifications.events.NewNotification(dt=None, **kwargs)

This event will be sent when a user is added to a group or when a user is mentioned

Returns

  • event - notification.new

  • time (string) - ISO8601 timestamp

  • dispatcher (string) - identifies the event’s dispatcher

  • channel (object) - The full channel object

  • organization_id (int) - organization ID

Following attributes are also available for room invitation:

  • inviter_id (int) - ID of the user who invited. This field is kept for backward compatibility

  • inviter (object) - The full inviter object

  • invitee_id (int) - ID of the user invited

Following attributes are available for events related to message and activities:

  • attachments (list) - message attachments

  • author (object) - full message author

  • content (str) - message text

Return type

Object

name = 'new'
ns = 'notification'
serialize()

Labeling

class labeling.events.LabeledMessage(dt=None, **kwargs)
Returns

  • all message fields, see chat.rpc.Channels.get_history

  • organization_id (int) - organization ID

  • event message.labeled

  • time (string) - ISO8601 timestamp

Return type

Object

name = 'labeled'
ns = 'message'