Add Users to Channel
    • Dark
      Light
    • PDF

    Add Users to Channel

    • Dark
      Light
    • PDF

    Article summary

    Post
    /api/v1/channels.invite

    Add a user or bulk users to a channel.

    For a user to invite other users, they must match at least one of the following premises:

    • The user is part of a room of any type and has the add-user-to-joined-room permission.
    • The user is part of a public room (t: 'c') and has the add-user-to-any-c-room permission.
    • The user is part of a private room (t: 'p') and has the add-user-to-any-p-room permission.

    Changelog

    VersionDescription
    0.48.0Added
    Header parameters
    X-Auth-Token
    stringRequired

    The authToken of the authenticated user.

    ExampleRScctEHSmLGZGywfIhWyRpyofhKOiMoUIpimhvheU3f
    X-User-Id
    stringRequired

    The userId of the authenticated user.

    ExamplerbAXPnMktTFbNpwtJ
    Body parameters
    Expand All
    object
    OneOf
    object
    roomId
    string Required

    The channel's ID.

    ExamplenSYqWzZ4GsKTX4dyK
    userId
    string Required

    The user id to be invited.

    ExampleByehQjC44FwMeiLbX
    object
    roomId
    string Required

    The channel's id

    ExamplenSYqWzZ4GsKTX4dyK
    userIds
    Array of object Required

    An array of the userId of users to be invited

    object
    type
    string
    value
    string

    You can enter the user ID of one user or add multiple users. Use any one of the objects above as the body parameters.

    Responses
    200

    OK

    Example 1
    {
      "channel": {
        "_id": "ByehQjC44FwMeiLbX",
        "ts": "2016-11-30T21:23:04.737Z",
        "t": "c",
        "name": "testing",
        "usernames": [
          "testing",
          "testing1"
        ],
        "msgs": 1,
        "_updatedAt": "2016-12-09T12:50:51.575Z",
        "lm": "2016-12-09T12:50:51.555Z"
      },
      "success": true
    }
    Example 2
    {
      "channel": {
        "_id": "ByehQjC44FwMeiLbX",
        "ts": "2016-11-30T21:23:04.737Z",
        "t": "c",
        "name": "testing",
        "usernames": "testing",
        "msgs": 1,
        "_updatedAt": "2016-12-09T12:50:51.575Z",
        "lm": "2016-12-09T12:50:51.555Z"
      },
      "success": true
    }
    Expand All
    object
    channel
    object
    _id
    string
    fname
    string
    customFields
    object
    description
    string
    broadcast
    boolean
    encrypted
    boolean
    federated
    boolean
    name
    string
    t
    string
    msgs
    integer
    usersCount
    integer
    u
    object
    _id
    string
    username
    string
    ts
    string
    ro
    boolean
    default
    boolean
    sysMes
    boolean
    _updatedAt
    string
    lm
    string
    lastMessage
    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
    success
    boolean

    Was this article helpful?

    What's Next
    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.