You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
matrix-spec/data/api/client-server/room_send.yaml

118 lines
4.0 KiB
YAML

# Copyright 2016 OpenMarket Ltd
# Copyright 2023 The Matrix.org Foundation C.I.C.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
openapi: 3.1.0
info:
title: Matrix Client-Server message event send API
version: 1.0.0
paths:
"/rooms/{roomId}/send/{eventType}/{txnId}":
put:
summary: Send a message event to the given room.
description: |-
This endpoint is used to send a message event to a room. Message events
allow access to historical events and pagination, making them suited
for "once-off" activity in a room.
The body of the request should be the content object of the event; the
fields in this object will vary depending on the type of event. See
[Room Events](/client-server-api/#room-events) for the m. event specification.
operationId: sendMessage
security:
- accessTokenQuery: []
- accessTokenBearer: []
parameters:
- in: path
name: roomId
description: The room to send the event to.
required: true
example: "!636q39766251:example.com"
schema:
type: string
- in: path
name: eventType
description: The type of event to send.
required: true
example: m.room.message
schema:
type: string
- in: path
name: txnId
description: |-
The [transaction ID](/client-server-api/#transaction-identifiers) for this event. Clients should generate an
ID unique across requests with the same access token; it will be
used by the server to ensure idempotency of requests.
required: true
example: "35"
schema:
type: string
requestBody:
content:
application/json:
schema:
type: object
example: {
"msgtype": "m.text",
"body": "hello"
}
required: true
responses:
"200":
description: An ID for the sent event.
content:
application/json:
schema:
type: object
properties:
event_id:
type: string
description: A unique identifier for the event.
required:
- event_id
examples:
response:
value: {
"event_id": "$YUwRidLecu:example.com"
}
"400":
description: |-
The request is invalid. A [standard error response](/client-server-api/#standard-error-response)
will be returned. As well as the normal common error codes, other reasons for rejection include:
- `M_DUPLICATE_ANNOTATION`: The request is an attempt to send a [duplicate annotation](/client-server-api/#avoiding-duplicate-annotations).
content:
application/json:
schema:
$ref: definitions/errors/error.yaml
tags:
- Room participation
servers:
- url: "{protocol}://{hostname}{basePath}"
variables:
protocol:
enum:
- http
- https
default: https
hostname:
default: localhost:8008
basePath:
default: /_matrix/client/v3
components:
securitySchemes:
accessTokenQuery:
$ref: definitions/security.yaml#/accessTokenQuery
accessTokenBearer:
$ref: definitions/security.yaml#/accessTokenBearer