Skip to main content
POST
/
workspace
/
{workspace_id}
/
realtime
/
channel
/
trigger
Create a new realtime trigger using XanoScript
curl --request POST \
  --url https://your-xano-instance.xano.io/api:meta/workspace/{workspace_id}/realtime/channel/trigger \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: text/x-xanoscript' \
  --data 'realtime_trigger foo {
  channel = "my_channel"
  input {
    enum action {
      values = ["message", "join"]
    }
    text channel
    object client {
      schema {
        json extras
        object permissions {
          schema {
            int dbo_id
            text row_id
          }
        }
      }
    }
    object options {
      schema {
        bool authenticated
        text channel
      }
    }
    json payload
  }
  stack {
    var $x1 {
      value = 123
    }
  }
  actions = {connection: true}
}
'
{
  "id": 1,
  "created_at": "2023-04-19 21:01:32+0000",
  "updated_at": "2023-04-19 21:01:32+0000",
  "name": "Realtime Trigger",
  "description": "My realtime trigger test description",
  "guid": "YE1fwVhQ-enRlc6Sb42Gqru58-0",
  "branch": "v1",
  "tag": [
    "example tag"
  ],
  "actions": {
    "message": true,
    "join": true
  },
  "xanoscript": {
    "status": "ok",
    "value": "<string>",
    "message": "<string>"
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

workspace_id
integer<int64>
required

Query Parameters

branch
string
default:""
include_xanoscript
boolean
default:false

Body

text/x-xanoscript

The body is of type string.

Example:

"realtime_trigger foo {\n channel = \"my_channel\"\n input {\n enum action {\n values = [\"message\", \"join\"]\n }\n text channel\n object client {\n schema {\n json extras\n object permissions {\n schema {\n int dbo_id\n text row_id\n }\n }\n }\n }\n object options {\n schema {\n bool authenticated\n text channel\n }\n }\n json payload\n }\n stack {\n var $x1 {\n value = 123\n }\n }\n actions = {connection: true}\n}\n"

Response

Success!

id
integer<int64>
default:1
created_at
string<timestamptz>
default:2023-04-19 21:01:32+0000
updated_at
string<timestamptz>
default:2023-04-19 21:01:32+0000
name
string
default:Realtime Trigger
description
string
default:My realtime trigger test description
guid
string
default:YE1fwVhQ-enRlc6Sb42Gqru58-0
branch
string
default:v1
tag
string[]
actions
object
xanoscript
object