Create DM
- Print
- DarkLight
- PDF
Create DM
- Print
- DarkLight
- PDF
Article summary
Did you find this summary helpful?
Thank you for your feedback
Post
/api/v1/im.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
}
object
username
string
The username to open a direct message session. This parameter is required if the usernames
parameter is not provided
usernames
string
List of usernames to open a multiple direct message session. This parameter is required if the username
parameter is not provided
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 1
{
"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
Example 1
{
"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"
}
Example 2
{
"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
Was this article helpful?