torqee Developers
Api reference/Webhooks

Create a webhook endpoint

POST
/api/v1/webhooks
AuthorizationBearer <token>

OAuth 2.1 authorization code flow with PKCE. Audience must be the connect URL.

In: header

Scope: torqee:webhooks:write, torqee:sessions:read

namestring
Length1 <= length <= 100
urlstring
Format"uri"
Lengthlength <= 2048
filtersarray<object | object>
enabled?boolean

Response Body

curl -X POST "https://connect.torqee.app/api/v1/webhooks" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "string",
    "url": "http://example.com",
    "filters": [
      {
        "type": "session.created"
      }
    ]
  }'
const body = JSON.stringify({
  "name": "string",
  "url": "http://example.com",
  "filters": [
    {
      "type": "session.created"
    }
  ]
})

fetch("https://connect.torqee.app/api/v1/webhooks", {
  body
})
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
  "strings"
)

func main() {
  url := "https://connect.torqee.app/api/v1/webhooks"
  body := strings.NewReader(`{
    "name": "string",
    "url": "http://example.com",
    "filters": [
      {
        "type": "session.created"
      }
    ]
  }`)
  req, _ := http.NewRequest("POST", url, body)
  req.Header.Add("Content-Type", "application/json")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://connect.torqee.app/api/v1/webhooks"
body = {
  "name": "string",
  "url": "http://example.com",
  "filters": [
    {
      "type": "session.created"
    }
  ]
}
response = requests.request("POST", url, json = body, headers = {
  "Content-Type": "application/json"
})

print(response.text)
{
  "id": "string",
  "name": "string",
  "url": "http://example.com",
  "filters": [
    {
      "type": "session.created",
      "sessionId": "string"
    }
  ],
  "enabled": true,
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z"
}
{
  "error": "invalid_request"
}
{
  "error": "unauthorized"
}
{
  "error": "insufficient_scope"
}
{
  "error": "workspace_not_found"
}
{
  "error": "internal_server_error"
}