Read Channel Messages Anonymously
    • Dark
      Light
    • PDF

    Read Channel Messages Anonymously

    • Dark
      Light
    • PDF

    Article summary

    Get
    /api/v1/channels.anonymousread

    Fetch the messages in a public channel to an anonymous user. You must enable Accounts_AllowAnonymousRead setting in the workspace.

    Changelog

    VersionDescription
    1.2.0Added
    Query parameters
    roomId
    string

    The room id. It is required if the roomName is not provided.

    Exampledlpfuijw7ej
    roomName
    string

    The room name. It is required if the roomId is not provided.

    Examplegeneral
    offset
    integer

    Number of items to "skip" in the query, i.e. requests return count items, skipping the first offset items.

    Example50
    count
    integer

    The number of items to return.

    Example50
    sort

    List of fields to order by, and in which direction. This is a JSON object, with properties listed in desired order, with values of 1 for ascending, or -1 for descending. For example, {"value": -1, "_id": 1}

    query

    This parameter allows you to use MongoDB query operators to search for specific data. For example, to query users with a name that contains the letter "g": query={ "name": { "$regex": "g" } }

    fields
    string

    This parameter accepts a JSON object with properties that have a value of 1 or 0 to include or exclude them in the response. For example, to only retrieve the usernames of users: fields={ "username": 1 }

    Responses
    200

    OK

    Example
    {
      "messages": [
        {
          "_id": "xadufzmxzYQp4H9py",
          "alias": "test",
          "msg": "Example message",
          "attachments": [],
          "parseUrls": true,
          "bot": {
            "i": "MnQyfhWt5LqZotyfc"
          },
          "groupable": false,
          "ts": "2018-10-05T01:10:47.524Z",
          "u": {
            "_id": "rocket.cat",
            "username": "rocket.cat",
            "name": "Rocket.Cat"
          },
          "rid": "GENERAL",
          "_updatedAt": "2018-10-05T13:42:51.163Z",
          "reactions": {
            ":grin:": {
              "usernames": [
                "marco.zoo"
              ]
            }
          },
          "mentions": [],
          "channels": [],
          "starred": {
            "_id": "KPkEYwKKBKZnEEPpt"
          }
        },
        {
          "_id": "id-1538701845987",
          "rid": "GENERAL",
          "msg": "This message was edited via API",
          "alias": "Gruggy",
          "emoji": ":smirk:",
          "avatar": "http://res.guggy.com/logo_128.png",
          "attachments": [
            {
              "collapsed": false,
              "color": "#ff0000",
              "text": "Yay for gruggy!",
              "ts": "2016-12-09T04:53:06Z",
              "message_link": "https://google.com",
              "thumb_url": "http://res.guggy.com/logo_128.png",
              "author_name": "Bradley Hilton",
              "author_link": "https://rocket.chat/",
              "author_icon": "https://avatars.githubusercontent.com/u/850391?v=3",
              "title": "Attachment Example",
              "title_link": "https://youtube.com",
              "title_link_download": true,
              "image_url": "http://res.guggy.com/logo_128.png",
              "audio_url": "http://www.w3schools.com/tags/horse.mp3",
              "video_url": "http://www.w3schools.com/tags/movie.mp4",
              "fields": [
                {
                  "short": true,
                  "title": "Test",
                  "value": "Testing out something or other"
                },
                {
                  "short": true,
                  "title": "Another Test",
                  "value": "[Link](https://google.com/) something and this and that."
                }
              ]
            }
          ],
          "ts": "2018-10-05T01:10:45.994Z",
          "u": {
            "_id": "rocketchat.internal.admin.test",
            "username": "rocketchat.internal.admin.test",
            "name": "RocketChat Internal Admin Test"
          },
          "_updatedAt": "2018-10-05T01:10:47.064Z",
          "editedBy": {
            "_id": "rocketchat.internal.admin.test",
            "username": "rocketchat.internal.admin.test"
          },
          "editedAt": "2018-10-05T01:10:46Z",
          "reactions": {
            ":smile:": {
              "usernames": [
                "rocketchat.internal.admin.test"
              ]
            },
            ":squid:": {
              "usernames": [
                "rocketchat.internal.admin.test"
              ]
            },
            ":bee:": {
              "usernames": [
                "rocketchat.internal.admin.test"
              ]
            },
            ":ant:": {
              "usernames": [
                "rocketchat.internal.admin.test"
              ]
            }
          },
          "mentions": [],
          "channels": [],
          "urls": []
        }
      ],
      "count": 2,
      "offset": 0,
      "total": 2,
      "success": true
    }
    Expand All
    object
    messages
    Array of object
    object
    _id
    string
    t
    string
    msg
    string
    groupable
    boolean
    blocks
    Array of object
    object
    type
    string
    blockId
    string
    callId
    string
    appId
    string
    ts
    string
    u
    object
    _id
    string
    username
    string
    name
    string
    rid
    string
    _updatedAt
    string
    urls
    Array of object
    object
    mentions
    Array of object
    object
    channels
    Array of object
    object
    md
    Array of object
    object
    type
    string
    value
    Array of object
    object
    type
    string
    value
    string
    count
    integer
    offset
    integer
    total
    integer
    success
    boolean

    Was this article helpful?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.