Create webhook
/webhook
Request Body
The environment to create the webhook in. Ignored for API tokens, which create in their own environment. Required for a dashboard session.
The event types to subscribe to. Left out or empty subscribes the webhook to all (["all"]). An unknown type is a 400.
allintegrated_account:createdintegrated_account:updatedintegrated_account:deletedintegrated_account:activeintegrated_account:post_connect_form_submittedintegrated_account:post_install_errorintegrated_account:validation_errorintegrated_account:authentication_errorintegrated_account:forbidden_errorintegrated_account:reactivatedintegrated_account:stalelink_token:connection_errorenvironment_integration:createdenvironment_integration:updatedenvironment_integration:deletedenvironment_unified_model:createdenvironment_unified_model:updatedenvironment_unified_model:deletedapi_token:createdapi_token:updatedapi_token:deletedsync_job_run:createdsync_job_run:updatedsync_job_run:startedsync_job_run:completedsync_job_run:failedsync_job_run:deletedsync_job_run:recordsync_job_run:record_errorsync_job_run:rate_limitedrecord:createdrecord:updatedrecord:deletedrecord:metasync_job_cron_trigger:failedbatch_job:dry_run_completedbatch_job:completedbatch_job:dry_run_failedbatch_job:failed+ 28 more
Whether the webhook is active or not.
trueThe URL where the webhook payload will be sent. It must be a public https URL: plain http, embedded credentials, localhost, a private, loopback, link-local or reserved IP address, and single-label host names are refused with a 400.
https://example.com/webhookResponse Body
The date and time when the webhook was created.
2021-08-10T10:00:00.000ZThe ID of the environment that this webhook belongs to.
05daecaf-4365-42e8-8370-8127de5dd717The list of event types that the webhook is subscribed to.
["integrated_account:created","integrated_account:updated"]allintegrated_account:createdintegrated_account:updatedintegrated_account:deletedintegrated_account:activeintegrated_account:post_connect_form_submittedintegrated_account:post_install_errorintegrated_account:validation_errorintegrated_account:authentication_errorintegrated_account:forbidden_errorintegrated_account:reactivatedintegrated_account:stalelink_token:connection_errorenvironment_integration:createdenvironment_integration:updatedenvironment_integration:deletedenvironment_unified_model:createdenvironment_unified_model:updatedenvironment_unified_model:deletedapi_token:createdapi_token:updatedapi_token:deletedsync_job_run:createdsync_job_run:updatedsync_job_run:startedsync_job_run:completedsync_job_run:failedsync_job_run:deletedsync_job_run:recordsync_job_run:record_errorsync_job_run:rate_limitedrecord:createdrecord:updatedrecord:deletedrecord:metasync_job_cron_trigger:failedbatch_job:dry_run_completedbatch_job:completedbatch_job:dry_run_failedbatch_job:failed+ 28 more
The ID of the webhook.
4a4de828-f4db-4c9e-adfd-434e0864c3c7Whether the webhook is active or not. Inactive webhooks will not receive any data.
trueThe secret key that will be used to sign the webhook payload.
d5fac1cb-1820-4da7-bfd8-a6b758bcf8ffThe URL where the webhook should send the data.
https://example.com/webhookThe date and time when the webhook was last updated.
2021-08-10T10:00:00.000ZErrors
| Status | Description |
|---|---|
400 | Invalid body, including a target_url that is not a public https URL, or unknown event types in event_types (the body's unknown_event_types lists up to 10 of them, each cut to 100 characters), or the environment already has as many webhooks as its plan allows. The message says why. Nothing is saved. |
truto webhooks create \
-b '{
"target_url": "https://example.com/webhook",
"is_active": true,
"event_types": [],
"environment_id": "your_environment_id"
}' \
-o jsonimport Truto from '@truto/truto-ts-sdk';
const truto = new Truto({
token: '<your_api_token>',
});
const body = {
"target_url": "https://example.com/webhook",
"is_active": true,
"event_types": [],
"environment_id": "your_environment_id"
};
const result = await truto.webhook.create(body);
console.log(result);import asyncio
from truto_python_sdk import TrutoApi
truto_api = TrutoApi(token="<your_api_token>")
async def main():
body = {
"target_url": "https://example.com/webhook",
"is_active": True,
"event_types": [],
"environment_id": "your_environment_id"
}
result = await truto_api.webhooks.create(body)
print(result)
asyncio.run(main())curl -X POST 'https://api.truto.one/webhook' \
-H 'Authorization: Bearer <your_api_token>' \
-H 'Content-Type: application/json' \
-d '{
"target_url": "https://example.com/webhook",
"is_active": true,
"event_types": [],
"environment_id": "your_environment_id"
}'const body = {
"target_url": "https://example.com/webhook",
"is_active": true,
"event_types": [],
"environment_id": "your_environment_id"
};
const response = await fetch('https://api.truto.one/webhook', {
method: 'POST',
headers: {
'Authorization': 'Bearer <your_api_token>',
'Content-Type': 'application/json',
},
body: JSON.stringify(body),
});
const data = await response.json();
console.log(data);import requests
url = "https://api.truto.one/webhook"
headers = {
"Authorization": "Bearer <your_api_token>",
"Content-Type": "application/json",
}
params = {
}
payload = {
"target_url": "https://example.com/webhook",
"is_active": True,
"event_types": [],
"environment_id": "your_environment_id"
}
response = requests.post(url, headers=headers, params=params, json=payload)
print(response.json())