Push a plugin's widget

POST https://runix.chat/api/v1/armada/widgets

A plugin's bot pushes a document for one of its widgets, or data for the document it pushed before, which lands in that document's data. Armada checks it against its plugin contract and manifest, keeps the latest for each widget and scope, and sends an armada_widget event to the users who can see that scope, at most once every two seconds.

Only a plugin's own bot can use this endpoint, for its own widgets and links.

Changes: New in Zulip 13.0 (feature level ZF-0be29a).

Usage examples

The -u line implements HTTP Basic authentication. See the Authorization header documentation for how to get those credentials for users and bots.

curl -sSX POST https://runix.chat/api/v1/armada/widgets \
    -u EMAIL_ADDRESS:API_KEY \
    --data-urlencode widget=gpus \
    --data-urlencode link_id=3 \
    --data-urlencode item= \
    --data-urlencode 'document={"blocks": [{"items": [], "label": "Machines", "type": "list"}], "data": {"free": "4 free"}, "rest": {"figure": "data.free", "sizer": "88 free"}, "version": 1}' \
    --data-urlencode 'data={"free": "2 free"}'

Parameters

widget string required

Example: "gpus"

The widget's key in the plugin's manifest.


item string optional

Example: ""

For a widget opened from a row, the row's key.

Defaults to "".


document object optional

Example: {"version": 1, "data": {"free": "4 free"}, "rest": {"figure": "data.free", "sizer": "88 free"}, "blocks": [{"type": "list", "label": "Machines", "items": []}]}

The widget document.


data object optional

Example: {"free": "2 free"}

Data for the document the widget has.


Response

Return values

  • version: integer

    How many times the document has changed.

Example response(s)

Changes: As of Zulip 7.0 (feature level 167), if any parameters sent in the request are not supported by this endpoint, a successful JSON response will include an ignored_parameters_unsupported array.

A typical successful JSON response may look like:

{
    "msg": "",
    "result": "success",
    "version": 3
}