Set webhooks
curl --request PUT \
--url https://api.hellotracks.com/v1/webhooks \
--header 'API-Key: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"webhooks": {
"job_completed": {
"url": "https://hooks.example.com/hellotracks/jobs",
"headers": {
"Authorization": "Bearer s3cr3t-example"
}
},
"clock_in_out": {
"url": ""
}
}
}
'import requests
url = "https://api.hellotracks.com/v1/webhooks"
payload = { "webhooks": {
"job_completed": {
"url": "https://hooks.example.com/hellotracks/jobs",
"headers": { "Authorization": "Bearer s3cr3t-example" }
},
"clock_in_out": { "url": "" }
} }
headers = {
"API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
webhooks: {
job_completed: {
url: 'https://hooks.example.com/hellotracks/jobs',
headers: {Authorization: 'Bearer s3cr3t-example'}
},
clock_in_out: {url: ''}
}
})
};
fetch('https://api.hellotracks.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://api.hellotracks.com/v1/webhooks",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'webhooks' => [
'job_completed' => [
'url' => 'https://hooks.example.com/hellotracks/jobs',
'headers' => [
'Authorization' => 'Bearer s3cr3t-example'
]
],
'clock_in_out' => [
'url' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"API-Key: <api-key>",
"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.hellotracks.com/v1/webhooks"
payload := strings.NewReader("{\n \"webhooks\": {\n \"job_completed\": {\n \"url\": \"https://hooks.example.com/hellotracks/jobs\",\n \"headers\": {\n \"Authorization\": \"Bearer s3cr3t-example\"\n }\n },\n \"clock_in_out\": {\n \"url\": \"\"\n }\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("API-Key", "<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.put("https://api.hellotracks.com/v1/webhooks")
.header("API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"webhooks\": {\n \"job_completed\": {\n \"url\": \"https://hooks.example.com/hellotracks/jobs\",\n \"headers\": {\n \"Authorization\": \"Bearer s3cr3t-example\"\n }\n },\n \"clock_in_out\": {\n \"url\": \"\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hellotracks.com/v1/webhooks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"webhooks\": {\n \"job_completed\": {\n \"url\": \"https://hooks.example.com/hellotracks/jobs\",\n \"headers\": {\n \"Authorization\": \"Bearer s3cr3t-example\"\n }\n },\n \"clock_in_out\": {\n \"url\": \"\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"webhooks": {
"job_created": {
"hasHeaders": false,
"headerNames": []
},
"job_updated": {
"hasHeaders": false,
"headerNames": []
},
"job_completed": {
"url": "https://hooks.example.com/hellotracks/jobs",
"hasHeaders": true,
"headerNames": [
"Authorization"
]
},
"job_archived": {
"hasHeaders": false,
"headerNames": []
},
"job_deleted": {
"hasHeaders": false,
"headerNames": []
},
"job_checked": {
"hasHeaders": false,
"headerNames": []
},
"place_checked": {
"hasHeaders": false,
"headerNames": []
},
"clock_in_out": {
"hasHeaders": false,
"headerNames": []
},
"alert_triggered": {
"hasHeaders": false,
"headerNames": []
}
}
},
"error": null,
"meta": {
"path": "/v1/webhooks",
"method": "PUT"
}
}{
"data": null,
"error": {
"code": "invalid_request",
"message": "date must be YYYY-MM-DD"
},
"meta": {
"path": "/jobs",
"method": "GET"
}
}{
"data": null,
"error": {
"code": "invalid_api_key",
"message": "Invalid Hellotracks API key."
},
"meta": {
"path": "/jobs",
"method": "GET"
}
}{
"data": null,
"error": {
"code": "forbidden",
"message": "No permission."
},
"meta": {
"path": "/jobs",
"method": "GET"
}
}{
"data": null,
"error": {
"code": "throttled",
"message": "Too many requests."
},
"meta": {
"path": "/jobs",
"method": "GET"
}
}Webhooks
Set webhooks
Sets the URL and extra headers of the webhooks sent. Only the webhooks and fields sent change. Private, loopback and localhost URLs are refused with 400 (invalid_data), and the message says which webhook and why, for example “webhook job_created: not a public host”. Admins and company keys only, because webhooks carry the company’s secrets in their headers; operators and workers get 403.
PUT
/
webhooks
Set webhooks
curl --request PUT \
--url https://api.hellotracks.com/v1/webhooks \
--header 'API-Key: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"webhooks": {
"job_completed": {
"url": "https://hooks.example.com/hellotracks/jobs",
"headers": {
"Authorization": "Bearer s3cr3t-example"
}
},
"clock_in_out": {
"url": ""
}
}
}
'import requests
url = "https://api.hellotracks.com/v1/webhooks"
payload = { "webhooks": {
"job_completed": {
"url": "https://hooks.example.com/hellotracks/jobs",
"headers": { "Authorization": "Bearer s3cr3t-example" }
},
"clock_in_out": { "url": "" }
} }
headers = {
"API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
webhooks: {
job_completed: {
url: 'https://hooks.example.com/hellotracks/jobs',
headers: {Authorization: 'Bearer s3cr3t-example'}
},
clock_in_out: {url: ''}
}
})
};
fetch('https://api.hellotracks.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://api.hellotracks.com/v1/webhooks",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'webhooks' => [
'job_completed' => [
'url' => 'https://hooks.example.com/hellotracks/jobs',
'headers' => [
'Authorization' => 'Bearer s3cr3t-example'
]
],
'clock_in_out' => [
'url' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"API-Key: <api-key>",
"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.hellotracks.com/v1/webhooks"
payload := strings.NewReader("{\n \"webhooks\": {\n \"job_completed\": {\n \"url\": \"https://hooks.example.com/hellotracks/jobs\",\n \"headers\": {\n \"Authorization\": \"Bearer s3cr3t-example\"\n }\n },\n \"clock_in_out\": {\n \"url\": \"\"\n }\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("API-Key", "<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.put("https://api.hellotracks.com/v1/webhooks")
.header("API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"webhooks\": {\n \"job_completed\": {\n \"url\": \"https://hooks.example.com/hellotracks/jobs\",\n \"headers\": {\n \"Authorization\": \"Bearer s3cr3t-example\"\n }\n },\n \"clock_in_out\": {\n \"url\": \"\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hellotracks.com/v1/webhooks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"webhooks\": {\n \"job_completed\": {\n \"url\": \"https://hooks.example.com/hellotracks/jobs\",\n \"headers\": {\n \"Authorization\": \"Bearer s3cr3t-example\"\n }\n },\n \"clock_in_out\": {\n \"url\": \"\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"webhooks": {
"job_created": {
"hasHeaders": false,
"headerNames": []
},
"job_updated": {
"hasHeaders": false,
"headerNames": []
},
"job_completed": {
"url": "https://hooks.example.com/hellotracks/jobs",
"hasHeaders": true,
"headerNames": [
"Authorization"
]
},
"job_archived": {
"hasHeaders": false,
"headerNames": []
},
"job_deleted": {
"hasHeaders": false,
"headerNames": []
},
"job_checked": {
"hasHeaders": false,
"headerNames": []
},
"place_checked": {
"hasHeaders": false,
"headerNames": []
},
"clock_in_out": {
"hasHeaders": false,
"headerNames": []
},
"alert_triggered": {
"hasHeaders": false,
"headerNames": []
}
}
},
"error": null,
"meta": {
"path": "/v1/webhooks",
"method": "PUT"
}
}{
"data": null,
"error": {
"code": "invalid_request",
"message": "date must be YYYY-MM-DD"
},
"meta": {
"path": "/jobs",
"method": "GET"
}
}{
"data": null,
"error": {
"code": "invalid_api_key",
"message": "Invalid Hellotracks API key."
},
"meta": {
"path": "/jobs",
"method": "GET"
}
}{
"data": null,
"error": {
"code": "forbidden",
"message": "No permission."
},
"meta": {
"path": "/jobs",
"method": "GET"
}
}{
"data": null,
"error": {
"code": "throttled",
"message": "Too many requests."
},
"meta": {
"path": "/jobs",
"method": "GET"
}
}Authorizations
Body
application/json