Skip to content

Latest commit

 

History

History
49 lines (39 loc) · 2.18 KB

File metadata and controls

49 lines (39 loc) · 2.18 KB

Create

Create a direct message session with another user.

URL Requires Auth HTTP Method
/api/v1/im.create yes POST

Payload

Argument Example Required Description
username rocket.cat The username to open a direct message session, required if usernames is not provided
usernames rocket.cat, anotheruser List of usernames to open a multiple direct message session, required if username is not provided
excludeSelf true Optional Default: false Creates the direct message session excluding the current authenticated user. Note the session will only be opened if the current user has the view-room-administration permission

Example Call

curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \
     -H "X-User-Id: aobEdbYhXfu5hkeqG" \
     -H "Content-type: application/json" \
     http://localhost:3000/api/v1/im.create \
     -d '{ "username": "rocket.cat" }'

Example Result

{
    "room": {
          "t": "d",
          "rid": "PMrDaS4axRqkjY7errocket.cat",
          "usernames": [
               "g1",
               "rocket.cat"
          ]
    },
    "success": true
}

Change Log

Version Description
0.59.0 Added
3.1.0 Added usernames fields
3.18.0 Added excludeSelf option