Create a webhook endpoint
curl --request POST \
--url https://prod.truv.com/v1/webhooks/ \
--header 'Content-Type: application/json' \
--header 'X-Access-Client-Id: <api-key>' \
--header 'X-Access-Secret: <api-key>' \
--data '
{
"name": "<string>",
"webhook_url": "http://example.com/",
"env_type": "dev",
"events": [
"task-status-updated",
"order-status-updated"
],
"enabled": true
}
'import requests
url = "https://prod.truv.com/v1/webhooks/"
payload = {
"name": "<string>",
"webhook_url": "http://example.com/",
"env_type": "dev",
"events": ["task-status-updated", "order-status-updated"],
"enabled": True
}
headers = {
"X-Access-Client-Id": "<api-key>",
"X-Access-Secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Access-Client-Id': '<api-key>',
'X-Access-Secret': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
webhook_url: 'http://example.com/',
env_type: 'dev',
events: ['task-status-updated', 'order-status-updated'],
enabled: true
})
};
fetch('https://prod.truv.com/v1/webhooks/', 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://prod.truv.com/v1/webhooks/",
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([
'name' => '<string>',
'webhook_url' => 'http://example.com/',
'env_type' => 'dev',
'events' => [
'task-status-updated',
'order-status-updated'
],
'enabled' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Access-Client-Id: <api-key>",
"X-Access-Secret: <api-key>"
],
]);
$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://prod.truv.com/v1/webhooks/"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"webhook_url\": \"http://example.com/\",\n \"env_type\": \"dev\",\n \"events\": [\n \"task-status-updated\",\n \"order-status-updated\"\n ],\n \"enabled\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Access-Client-Id", "<api-key>")
req.Header.Add("X-Access-Secret", "<api-key>")
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://prod.truv.com/v1/webhooks/")
.header("X-Access-Client-Id", "<api-key>")
.header("X-Access-Secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"webhook_url\": \"http://example.com/\",\n \"env_type\": \"dev\",\n \"events\": [\n \"task-status-updated\",\n \"order-status-updated\"\n ],\n \"enabled\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://prod.truv.com/v1/webhooks/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Access-Client-Id"] = '<api-key>'
request["X-Access-Secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"webhook_url\": \"http://example.com/\",\n \"env_type\": \"dev\",\n \"events\": [\n \"task-status-updated\",\n \"order-status-updated\"\n ],\n \"enabled\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "48427a36d43c4d5aa6324bc06c692456",
"name": "<string>",
"webhook_url": "http://example.com/",
"events": [
"task-status-updated",
"order-status-updated"
],
"env_type": "dev",
"enabled": true,
"created_at": "2022-05-04T11:30:00Z",
"updated_at": "2022-05-04T12:00:00Z"
}{
"error": {
"code": "incorrect_parameters",
"message": "Incorrect request parameters",
"extra": {
"invalid-params": [
{
"field": "access_token",
"message": "This field is required."
}
]
}
}
}{
"error": {
"code": "authentication_failed",
"message": "No such token"
}
}{
"error": {
"code": "not_authenticated",
"message": "Authentication credentials were not provided."
}
}Webhook Endpoints
Create a webhook endpoint
The endpoint creates a webhook.
POST
/
v1
/
webhooks
/
Create a webhook endpoint
curl --request POST \
--url https://prod.truv.com/v1/webhooks/ \
--header 'Content-Type: application/json' \
--header 'X-Access-Client-Id: <api-key>' \
--header 'X-Access-Secret: <api-key>' \
--data '
{
"name": "<string>",
"webhook_url": "http://example.com/",
"env_type": "dev",
"events": [
"task-status-updated",
"order-status-updated"
],
"enabled": true
}
'import requests
url = "https://prod.truv.com/v1/webhooks/"
payload = {
"name": "<string>",
"webhook_url": "http://example.com/",
"env_type": "dev",
"events": ["task-status-updated", "order-status-updated"],
"enabled": True
}
headers = {
"X-Access-Client-Id": "<api-key>",
"X-Access-Secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Access-Client-Id': '<api-key>',
'X-Access-Secret': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
webhook_url: 'http://example.com/',
env_type: 'dev',
events: ['task-status-updated', 'order-status-updated'],
enabled: true
})
};
fetch('https://prod.truv.com/v1/webhooks/', 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://prod.truv.com/v1/webhooks/",
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([
'name' => '<string>',
'webhook_url' => 'http://example.com/',
'env_type' => 'dev',
'events' => [
'task-status-updated',
'order-status-updated'
],
'enabled' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Access-Client-Id: <api-key>",
"X-Access-Secret: <api-key>"
],
]);
$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://prod.truv.com/v1/webhooks/"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"webhook_url\": \"http://example.com/\",\n \"env_type\": \"dev\",\n \"events\": [\n \"task-status-updated\",\n \"order-status-updated\"\n ],\n \"enabled\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Access-Client-Id", "<api-key>")
req.Header.Add("X-Access-Secret", "<api-key>")
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://prod.truv.com/v1/webhooks/")
.header("X-Access-Client-Id", "<api-key>")
.header("X-Access-Secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"webhook_url\": \"http://example.com/\",\n \"env_type\": \"dev\",\n \"events\": [\n \"task-status-updated\",\n \"order-status-updated\"\n ],\n \"enabled\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://prod.truv.com/v1/webhooks/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Access-Client-Id"] = '<api-key>'
request["X-Access-Secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"webhook_url\": \"http://example.com/\",\n \"env_type\": \"dev\",\n \"events\": [\n \"task-status-updated\",\n \"order-status-updated\"\n ],\n \"enabled\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "48427a36d43c4d5aa6324bc06c692456",
"name": "<string>",
"webhook_url": "http://example.com/",
"events": [
"task-status-updated",
"order-status-updated"
],
"env_type": "dev",
"enabled": true,
"created_at": "2022-05-04T11:30:00Z",
"updated_at": "2022-05-04T12:00:00Z"
}{
"error": {
"code": "incorrect_parameters",
"message": "Incorrect request parameters",
"extra": {
"invalid-params": [
{
"field": "access_token",
"message": "This field is required."
}
]
}
}
}{
"error": {
"code": "authentication_failed",
"message": "No such token"
}
}{
"error": {
"code": "not_authenticated",
"message": "Authentication credentials were not provided."
}
}Authorizations
Client ID
Client Access Key
Body
application/json
Public name for this webhook config.
Maximum string length:
128Webhook URL where event data will be sent.
Maximum string length:
2048Example:
"http://example.com/"
Type of environment.
Available options:
sandbox, dev, prod Example:
"dev"
List of events sent to this webhook URL.
Available options:
task-status-updated, order-status-updated, order-created, link-connected, link-disconnected, order-refresh-failed, link-deleted, employment-created, employment-updated, profile-created, profile-updated, statements-created, statements-updated, shifts-created, shifts-updated, bank-accounts-created, bank-accounts-updated, order-finalized, order-batch-completed, certification-completed Example:
[
"task-status-updated",
"order-status-updated"
]
Whether the webhook is active.
Response
Unique identifier of the webhook.
Maximum string length:
32Example:
"48427a36d43c4d5aa6324bc06c692456"
Public name for this webhook config.
Maximum string length:
128Webhook URL where event data will be sent.
Maximum string length:
2048Example:
"http://example.com/"
List of events sent to this webhook URL.
Available options:
task-status-updated, order-status-updated, order-created, link-connected, link-disconnected, order-refresh-failed, link-deleted, employment-created, employment-updated, profile-created, profile-updated, statements-created, statements-updated, shifts-created, shifts-updated, bank-accounts-created, bank-accounts-updated, order-finalized, order-batch-completed, certification-completed Example:
[
"task-status-updated",
"order-status-updated"
]
Type of environment.
Available options:
sandbox, dev, prod Example:
"dev"
Whether the webhook is active.
Timestamp when the webhook was created.
Example:
"2022-05-04T11:30:00Z"
Timestamp when the webhook was updated last time.
Example:
"2022-05-04T12:00:00Z"
Was this page helpful?