Webhooks
Set Webhook
POST
/
hook
Set Webhook
curl --request POST \
--url https://prod.claimr.io/api/v1/hook \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"uri": "<string>",
"secret": "<string>",
"hook_id": "prod",
"pids": []
}
'import requests
url = "https://prod.claimr.io/api/v1/hook"
payload = {
"uri": "<string>",
"secret": "<string>",
"hook_id": "prod",
"pids": []
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({uri: '<string>', secret: '<string>', hook_id: 'prod', pids: []})
};
fetch('https://prod.claimr.io/api/v1/hook', 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.claimr.io/api/v1/hook",
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([
'uri' => '<string>',
'secret' => '<string>',
'hook_id' => 'prod',
'pids' => [
]
]),
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://prod.claimr.io/api/v1/hook"
payload := strings.NewReader("{\n \"uri\": \"<string>\",\n \"secret\": \"<string>\",\n \"hook_id\": \"prod\",\n \"pids\": []\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://prod.claimr.io/api/v1/hook")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"uri\": \"<string>\",\n \"secret\": \"<string>\",\n \"hook_id\": \"prod\",\n \"pids\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://prod.claimr.io/api/v1/hook")
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 \"uri\": \"<string>\",\n \"secret\": \"<string>\",\n \"hook_id\": \"prod\",\n \"pids\": []\n}"
response = http.request(request)
puts response.read_body{
"success": true
}{
"success": true,
"error": {
"code": 400,
"message": "bad request"
}
}{
"success": true,
"error": {
"code": 401,
"message": "unauthorized"
}
}{
"success": true,
"error": {
"code": 403,
"message": "access denied"
}
}{
"success": true,
"error": {
"code": 500,
"message": "internal error"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Scope of a hook. Supported scopes are 'user_activity', 'user_reward' and 'referral'
Available options:
user_activity, user_reward, referral Webhook endpoint URL
Secret used to create verification signature
Unique hook id (defaults to 'prod' if not provided)
Campaign IDs to scope the webhook to specific campaigns (empty array means all campaigns)
campaign id
Response
Webhook successfully set.
Example:
true
⌘I
Set Webhook
curl --request POST \
--url https://prod.claimr.io/api/v1/hook \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"uri": "<string>",
"secret": "<string>",
"hook_id": "prod",
"pids": []
}
'import requests
url = "https://prod.claimr.io/api/v1/hook"
payload = {
"uri": "<string>",
"secret": "<string>",
"hook_id": "prod",
"pids": []
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({uri: '<string>', secret: '<string>', hook_id: 'prod', pids: []})
};
fetch('https://prod.claimr.io/api/v1/hook', 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.claimr.io/api/v1/hook",
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([
'uri' => '<string>',
'secret' => '<string>',
'hook_id' => 'prod',
'pids' => [
]
]),
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://prod.claimr.io/api/v1/hook"
payload := strings.NewReader("{\n \"uri\": \"<string>\",\n \"secret\": \"<string>\",\n \"hook_id\": \"prod\",\n \"pids\": []\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://prod.claimr.io/api/v1/hook")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"uri\": \"<string>\",\n \"secret\": \"<string>\",\n \"hook_id\": \"prod\",\n \"pids\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://prod.claimr.io/api/v1/hook")
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 \"uri\": \"<string>\",\n \"secret\": \"<string>\",\n \"hook_id\": \"prod\",\n \"pids\": []\n}"
response = http.request(request)
puts response.read_body{
"success": true
}{
"success": true,
"error": {
"code": 400,
"message": "bad request"
}
}{
"success": true,
"error": {
"code": 401,
"message": "unauthorized"
}
}{
"success": true,
"error": {
"code": 403,
"message": "access denied"
}
}{
"success": true,
"error": {
"code": 500,
"message": "internal error"
}
}