Get subscribed streams

Get all streams that the user is subscribed to.

GET https://chat.virginvoyages.com/api/v1/users/me/subscriptions

Usage examples

#!/usr/bin/env python3

import zulip

# Pass the path to your zuliprc file here.
client = zulip.Client(config_file="~/zuliprc")

# Get all streams that the user is subscribed to
result = client.list_subscriptions()
print(result)

More examples and documentation can be found here.

const zulip = require('zulip-js');

// Pass the path to your zuliprc file here.
const config = {
    zuliprc: 'zuliprc',
};

zulip(config).then((client) => {
    // Get all streams that the user is subscribed to
    client.streams.subscriptions.retrieve().then(console.log);
});

curl -X GET https://chat.virginvoyages.com/api/v1/users/me/subscriptions \
    -u BOT_EMAIL_ADDRESS:BOT_API_KEY

You may pass the include_subscribers query parameter as follows:

curl -X GET https://chat.virginvoyages.com/api/v1/users/me/subscriptions?include_subscribers=true \
    -u BOT_EMAIL_ADDRESS:BOT_API_KEY

Arguments

Argument Example Required Description
include_subscribers true No

Set to true if you would like each stream's info to include a list of current subscribers to that stream. (This may be significantly slower in organizations with thousands of users.) Defaults to false.

Response

Return values

  • subscriptions: A list of dictionaries where each dictionary contains information about one of the subscribed streams.
    • stream_id: The unique ID of a stream.
    • name: The name of a stream.
    • description: A short description of a stream.
    • invite-only: Specifies whether a stream is private or not. Only people who have been invited can access a private stream.
    • subscribers: A list of email addresses of users who are also subscribed to a given stream. Included only if include_subscribers is true.
    • desktop_notifications: A boolean specifiying whether desktop notifications are enabled for the given stream.
    • push_notifications: A boolean specifiying whether push notifications are enabled for the given stream.
    • audible_notifications: A boolean specifiying whether audible notifications are enabled for the given stream.
    • pin_to_top: A boolean specifying whether the given stream has been pinned to the top.
    • email_address: Email address of the given stream.
    • in_home_view: Whether the given stream is muted or not. Muted streams do not count towards your total unread count and thus, do not show up in All messages view (previously known as Home view).
    • color: Stream color.

Example response

A typical successful JSON response may look like:

{
    "msg": "",
    "result": "success",
    "subscriptions": [
        {
            "audible_notifications": true,
            "color": "#e79ab5",
            "description": "A Scandinavian country",
            "desktop_notifications": true,
            "email_address": "Denmark+187b4125ed36d6af8b5d03ef4f65c0cf@zulipdev.com:9981",
            "in_home_view": true,
            "invite_only": false,
            "name": "Denmark",
            "pin_to_top": false,
            "push_notifications": false,
            "stream_id": 1,
            "subscribers": [
                "ZOE@zulip.com",
                "hamlet@zulip.com",
                "iago@zulip.com",
                "othello@zulip.com",
                "prospero@zulip.com"
            ]
        },
        {
            "audible_notifications": true,
            "color": "#e79ab5",
            "description": "Located in the United Kingdom",
            "desktop_notifications": true,
            "email_address": "Scotland+f5786390183e60a1ccb18374f9d05649@zulipdev.com:9981",
            "in_home_view": true,
            "invite_only": false,
            "name": "Scotland",
            "pin_to_top": false,
            "push_notifications": false,
            "stream_id": 3,
            "subscribers": [
                "ZOE@zulip.com",
                "iago@zulip.com",
                "othello@zulip.com",
                "prospero@zulip.com"
            ]
        }
    ]
}