Skip to main content
POST
/
v1
/
webhook
JavaScript
import Roark from '@roarkanalytics/sdk';

const client = new Roark({
  bearerToken: process.env['ROARK_API_BEARER_TOKEN'], // This is the default and can be omitted
});

const webhook = await client.webhook.create({
  events: ['CALL_ANALYSIS_COMPLETED'],
  url: 'https://example.com',
});

console.log(webhook.data);
import os
from roark_analytics import Roark

client = Roark(
    bearer_token=os.environ.get("ROARK_API_BEARER_TOKEN"),  # This is the default and can be omitted
)
webhook = client.webhook.create(
    events=["CALL_ANALYSIS_COMPLETED"],
    url="https://example.com",
)
print(webhook.data)
curl --request POST \
  --url https://api.roark.ai/v1/webhook \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "url": "<string>",
  "events": [],
  "description": "<string>",
  "headers": {}
}
'
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.roark.ai/v1/webhook",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'url' => '<string>',
    'events' => [
        
    ],
    'description' => '<string>',
    'headers' => [
        
    ]
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "Content-Type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

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

func main() {

	url := "https://api.roark.ai/v1/webhook"

	payload := strings.NewReader("{\n  \"url\": \"<string>\",\n  \"events\": [],\n  \"description\": \"<string>\",\n  \"headers\": {}\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.roark.ai/v1/webhook")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"url\": \"<string>\",\n  \"events\": [],\n  \"description\": \"<string>\",\n  \"headers\": {}\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.roark.ai/v1/webhook")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"url\": \"<string>\",\n  \"events\": [],\n  \"description\": \"<string>\",\n  \"headers\": {}\n}"

response = http.request(request)
puts response.read_body
{
  "data": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "description": "<string>",
    "url": "<string>",
    "headers": {},
    "events": [],
    "createdAt": "<string>",
    "updatedAt": "<string>",
    "signingSecret": "<string>"
  }
}
{
  "type": "authentication",
  "code": "unauthorized",
  "message": "Authentication required"
}
{
  "type": "internal",
  "code": "internal_error",
  "message": "Internal server error"
}

Authorizations

Authorization
string
header
required

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

Body

application/json

Input for creating a webhook

url
string<uri>
required

Webhook URL

events
enum<string>[]
required

Event types to subscribe to (at least one required)

Minimum array length: 1
Available options:
CALL_ANALYSIS_COMPLETED,
CALL_ANALYSIS_FAILED,
CALL_ANALYSIS_CANCELLED,
CALL_EVALUATION_COMPLETED,
CALL_EVALUATION_FAILED,
SIMULATION_RUN_PLAN_JOB_STARTED,
SIMULATION_RUN_PLAN_JOB_COMPLETED,
SIMULATION_RUN_PLAN_JOB_FAILED,
SIMULATION_RUN_PLAN_JOB_CANCELLED,
SIMULATION_JOB_STARTED,
SIMULATION_JOB_COMPLETED,
SIMULATION_JOB_FAILED,
SIMULATION_JOB_CANCELLED,
METRIC_COLLECTION_JOB_COMPLETED,
METRIC_COLLECTION_JOB_FAILED,
CHAT_ANALYSIS_COMPLETED,
CHAT_ANALYSIS_FAILED,
ISSUE_OPENED,
ISSUE_RESOLVED
description
string | null

Webhook description

headers
object

Request headers (e.g. authorization tokens)

Response

The created webhook with signing secret

data
object
required

Webhook response with signing secret (returned on creation)