Skip to content

Send a Message to the Current Viewer

POST /whisper_self

Uses the viewer represented by the JWT.

Authorization

Send Authorization: <Twitch Extension Client ID> <Muxy JWT>. The JWT role must satisfy the endpoint requirements shown in the examples.

Request body

Content type: application/json

Schema

{
  "type": "object",
  "properties": {
    "target": {
      "type": "string",
      "description": "PubSub target; use broadcast for a channel-wide message."
    },
    "event": {
      "type": "string",
      "default": "default"
    },
    "user_id": {
      "type": "string",
      "description": "Target Twitch channel ID for channel broadcasts."
    },
    "data": {
      "type": "object",
      "additionalProperties": true
    }
  },
  "required": [
    "data"
  ]
}

Example

{
  "event": "score-updated",
  "data": {
    "score": 42
  }
}

Responses

200 Response

Message accepted for delivery.

Content type: application/json

Schema
{
  "type": "object"
}
Example
{}

400 Error

The request body or poll configuration is invalid.

Content type: application/json

Schema
{
  "type": "object",
  "properties": {
    "reason": {
      "type": "string"
    }
  }
}
Example
{
  "reason": "Invalid body"
}

403 Error

The JWT role is not allowed to perform this operation.

Content type: application/json

Schema
{
  "type": "object",
  "properties": {
    "reason": {
      "type": "string"
    }
  }
}
Example
{
  "reason": "role is not authorized"
}

Generated API reference

This endpoint is generated from rest-v1.yaml.