Post
/api/v1/dm.create
Create a direct message session with another user or more than one user.
Change Log
Version | Description |
---|---|
0.59.0 | Added |
3.1.0 | Added usernames fields |
3.18.0 | Added excludeSelf option |
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
Example
{
"username": "kim.dok",
"excludeSelf": true
}
OneOf
object
object
username
string
The username of the user to open a direct message session.
excludeSelf
boolean
Creates the direct message session excluding the current authenticated user. The session will only be opened if the current user has the view-room-administration
permission
object
object
usernames
string
Comma-seperated list of usernames to open a multiple direct message session.
excludeSelf
boolean
Creates the direct message session excluding the current authenticated user. The session will only be opened if the current user has the view-room-administration
permission
Responses
200
OK
Example
{
"room": {
"t": "d",
"rid": "PMrDaS4axRqkjY7errocket.cat",
"usernames": [
"g1",
"rocket.cat"
]
},
"success": true
}
object
room
object
t
string
rid
string
usernames
Array of string
string
success
boolean
400
Bad Request
Missing parameter
{
"success": false,
"error": "must have required property 'usernames'\n must have required property 'username'\n must match exactly one schema in oneOf [invalid-params]",
"errorType": "invalid-params"
}
Invalid User
{
"success": false,
"error": "Invalid user [error-invalid-user]",
"errorType": "error-invalid-user",
"details": {
"method": "createDirectMessage"
}
}
object
success
boolean
error
string
errorType
string
401
Unauthorized
Authorization Error
{
"status": "error",
"message": "You must be logged in to do this."
}
object
status
string
message
string