Send webhook events
curl --request POST \
--url https://api.stackone.com/v2/webhooks/events \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"account_id": "<string>",
"events": [
{
"event": "hris_employees.created",
"record_id": "123",
"data": {
"first_name": "Jane"
}
}
],
"webhook_ids": [
"<string>"
]
}
'import requests
url = "https://api.stackone.com/v2/webhooks/events"
payload = {
"account_id": "<string>",
"events": [
{
"event": "hris_employees.created",
"record_id": "123",
"data": { "first_name": "Jane" }
}
],
"webhook_ids": ["<string>"]
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
account_id: '<string>',
events: [
{event: 'hris_employees.created', record_id: '123', data: {first_name: 'Jane'}}
],
webhook_ids: ['<string>']
})
};
fetch('https://api.stackone.com/v2/webhooks/events', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.stackone.com/v2/webhooks/events",
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([
'account_id' => '<string>',
'events' => [
[
'event' => 'hris_employees.created',
'record_id' => '123',
'data' => [
'first_name' => 'Jane'
]
]
],
'webhook_ids' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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.stackone.com/v2/webhooks/events"
payload := strings.NewReader("{\n \"account_id\": \"<string>\",\n \"events\": [\n {\n \"event\": \"hris_employees.created\",\n \"record_id\": \"123\",\n \"data\": {\n \"first_name\": \"Jane\"\n }\n }\n ],\n \"webhook_ids\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.stackone.com/v2/webhooks/events")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"account_id\": \"<string>\",\n \"events\": [\n {\n \"event\": \"hris_employees.created\",\n \"record_id\": \"123\",\n \"data\": {\n \"first_name\": \"Jane\"\n }\n }\n ],\n \"webhook_ids\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.stackone.com/v2/webhooks/events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"account_id\": \"<string>\",\n \"events\": [\n {\n \"event\": \"hris_employees.created\",\n \"record_id\": \"123\",\n \"data\": {\n \"first_name\": \"Jane\"\n }\n }\n ],\n \"webhook_ids\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"deliveries": [
{
"webhook_id": "<string>",
"events": 123
}
]
}{
"statusCode": 400,
"message": "Bad Request",
"timestamp": "2023-05-30T00:00:00.000Z",
"data": {
"statusCode": 400,
"message": "Bad Request",
"headers": {
"content-type": "application/json",
"x-request-id": "5678c28b211dace4e0a0f9171e6b88c5"
}
},
"provider_errors": [
{
"status": 400,
"url": "https://api.provider.com/v1/resource",
"raw": {
"message": "Invalid input parameters"
},
"headers": {
"content-type": "application/json",
"x-request-id": "5678c28b211dace4e0a0f9171e6b88c5"
}
}
]
}{
"statusCode": 401,
"message": "Unauthorized",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 403,
"message": "Forbidden resource",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 404,
"message": "Not Found",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 408,
"message": "Request timed out",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 409,
"message": "Conflict",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 422,
"message": "Unprocessable Entity",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 429,
"message": "Too many requests",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 500,
"message": "Internal server error",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 501,
"message": "Not Implemented",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 502,
"message": "Bad Gateway",
"timestamp": "2023-05-30T00:00:00.000Z"
}Send webhook events
Sends record events for an account to the project webhooks subscribed to them, for testing a webhook receiver. Delivery is asynchronous: the response lists the deliveries started, and each is retried until the endpoint accepts it or retries run out.
POST
/
v2
/
webhooks
/
events
Send webhook events
curl --request POST \
--url https://api.stackone.com/v2/webhooks/events \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"account_id": "<string>",
"events": [
{
"event": "hris_employees.created",
"record_id": "123",
"data": {
"first_name": "Jane"
}
}
],
"webhook_ids": [
"<string>"
]
}
'import requests
url = "https://api.stackone.com/v2/webhooks/events"
payload = {
"account_id": "<string>",
"events": [
{
"event": "hris_employees.created",
"record_id": "123",
"data": { "first_name": "Jane" }
}
],
"webhook_ids": ["<string>"]
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
account_id: '<string>',
events: [
{event: 'hris_employees.created', record_id: '123', data: {first_name: 'Jane'}}
],
webhook_ids: ['<string>']
})
};
fetch('https://api.stackone.com/v2/webhooks/events', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.stackone.com/v2/webhooks/events",
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([
'account_id' => '<string>',
'events' => [
[
'event' => 'hris_employees.created',
'record_id' => '123',
'data' => [
'first_name' => 'Jane'
]
]
],
'webhook_ids' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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.stackone.com/v2/webhooks/events"
payload := strings.NewReader("{\n \"account_id\": \"<string>\",\n \"events\": [\n {\n \"event\": \"hris_employees.created\",\n \"record_id\": \"123\",\n \"data\": {\n \"first_name\": \"Jane\"\n }\n }\n ],\n \"webhook_ids\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.stackone.com/v2/webhooks/events")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"account_id\": \"<string>\",\n \"events\": [\n {\n \"event\": \"hris_employees.created\",\n \"record_id\": \"123\",\n \"data\": {\n \"first_name\": \"Jane\"\n }\n }\n ],\n \"webhook_ids\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.stackone.com/v2/webhooks/events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"account_id\": \"<string>\",\n \"events\": [\n {\n \"event\": \"hris_employees.created\",\n \"record_id\": \"123\",\n \"data\": {\n \"first_name\": \"Jane\"\n }\n }\n ],\n \"webhook_ids\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"deliveries": [
{
"webhook_id": "<string>",
"events": 123
}
]
}{
"statusCode": 400,
"message": "Bad Request",
"timestamp": "2023-05-30T00:00:00.000Z",
"data": {
"statusCode": 400,
"message": "Bad Request",
"headers": {
"content-type": "application/json",
"x-request-id": "5678c28b211dace4e0a0f9171e6b88c5"
}
},
"provider_errors": [
{
"status": 400,
"url": "https://api.provider.com/v1/resource",
"raw": {
"message": "Invalid input parameters"
},
"headers": {
"content-type": "application/json",
"x-request-id": "5678c28b211dace4e0a0f9171e6b88c5"
}
}
]
}{
"statusCode": 401,
"message": "Unauthorized",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 403,
"message": "Forbidden resource",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 404,
"message": "Not Found",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 408,
"message": "Request timed out",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 409,
"message": "Conflict",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 422,
"message": "Unprocessable Entity",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 429,
"message": "Too many requests",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 500,
"message": "Internal server error",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 501,
"message": "Not Implemented",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 502,
"message": "Bad Gateway",
"timestamp": "2023-05-30T00:00:00.000Z"
}Authorizations
Body
application/json
Was this page helpful?