POST
https://api.cryptohopper.com/v1/api/webhooks
Registers a URL that receives notifications for your app, or updates the message types when your app already has a webhook with that URL. Deliveries only go to users who granted your app the notifications scope.
message_types is one comma-separated string. Types: trade_completed, trade_error, order_cancelled, order_placed, config_error, on_first_start, on_trigger, on_panic_start, on_panic_end, aibot_proposal. With validation_code, Cryptohopper first POSTs to the URL, which must start with https:// and answer HTTP 200 with exactly that code as the body. Only https:// URLs receive deliveries. Each delivery is a JSON POST with an X-Hub-Signature header: the HMAC-SHA512 of the body, keyed with your app's client secret. Needs a valid access token; no scope is checked.
Example request
curl -X POST "https://api.cryptohopper.com/v1/api/webhooks" \
-H "access-token: YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"webhook_url":"https://example.com/cryptohopper/webhook","message_types":"trade_completed,order_placed,config_error","validation_code":"a1b2c3d4"}'
const response = await fetch('https://api.cryptohopper.com/v1/api/webhooks', {
method: 'POST',
headers: {
"access-token": "YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"webhook_url": "https://example.com/cryptohopper/webhook",
"message_types": "trade_completed,order_placed,config_error",
"validation_code": "a1b2c3d4"
})
});
const data = await response.json();
import requests
response = requests.post(
"https://api.cryptohopper.com/v1/api/webhooks",
headers={
"access-token": "YOUR_ACCESS_TOKEN"
},
json={
"webhook_url": "https://example.com/cryptohopper/webhook",
"message_types": "trade_completed,order_placed,config_error",
"validation_code": "a1b2c3d4"
},
)
data = response.json()
$ch = curl_init('https://api.cryptohopper.com/v1/api/webhooks');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'access-token: YOUR_ACCESS_TOKEN',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'webhook_url' => 'https://example.com/cryptohopper/webhook',
'message_types' => 'trade_completed,order_placed,config_error',
'validation_code' => 'a1b2c3d4',
]),
]);
$data = json_decode(curl_exec($ch), true);
Parameters
Headers
| Name | Type | Required | Description |
|---|---|---|---|
access-token |
string | Required | The OAuth access token of the user. |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
webhook_url | string | Required | |
message_types | string | Required | |
validation_code | string | Optional |
Response
{
"data": {
"message": "Webhook has been created.",
"id": 1234,
"webhook_url": "https://example.com/cryptohopper/webhook",
"message_types": [
"trade_completed",
"order_placed",
"config_error"
]
}
}