Webhook
I webhook in uscita inviano con POST un evento JSON firmato al tuo URL quando qualcosa cambia in TaskForce. I webhook di chat in ingresso permettono ai tuoi strumenti di pubblicare messaggi in un canale di chat di TaskForce.
Configurazione
Apri Impostazioni > Workspace > Webhook (Settings > Workspace > Webhooks). La visualizzazione richiede il permesso view webhooks; creare e modificare i webhook richiede manage webhooks.
| Campo | Obbligatorio | Descrizione |
|---|---|---|
| Name | No | Etichetta facoltativa, massimo 255 caratteri. |
| Destination URL | Sì | Dove TaskForce invia gli eventi con POST. Massimo 2048 caratteri. |
| Subscribed events | No | tasks.*, projects.*, comments.*, users.*. Lasciali tutti deselezionati per ricevere ogni evento. |
| Shared secret | Sì | Il tuo secret, massimo 255 caratteri. È la chiave HMAC per X-Webhook-Signature. |
- Le credenziali vengono mostrate una sola volta dopo la creazione. Conserva il secret condiviso dal tuo lato.
- La schermata mostra anche una chiave di firma generata. Le firme vengono calcolate con il secret condiviso, non con quella chiave, e ruotare solo la chiave non le cambia. Per cambiare il secret di firma, ruota e inserisci un nuovo secret condiviso.
- La revoca interrompe le consegne; la rotazione riattiva un webhook revocato.
- La vista Logs elenca gli ultimi 50 tentativi di consegna con codice di stato e risposta, e permette di ritentarne uno.
Eventi
| Evento | entityType | Si attiva quando |
|---|---|---|
tasks.created | task | Un'attività è stata creata nell'app. |
tasks.updated | task | Un'attività è stata modificata nell'app. |
tasks.deleted | task | Un'attività è stata eliminata. |
tasks.completed | task | Un'attività è stata contrassegnata come completata. |
tasks.reopened | task | Un'attività completata è stata riaperta. |
projects.created | project | Un progetto è stato creato nell'app. |
projects.updated | project | Un progetto è stato modificato nell'app. |
projects.archived | project | Lo stato di un progetto è cambiato in 2 (mostrato nell'app come On hold). |
task-comment.created | task-comment | È stato pubblicato un commento. |
task-comment.updated | task-comment | Un commento è stato modificato. |
users.created (al momento non viene consegnato) | user | Elencato nell'app, ma al momento non consegnato (vedi nota). |
users.updated (al momento non viene consegnato) | user | Elencato nell'app, ma al momento non consegnato (vedi nota). |
Gli eventi vengono inviati solo per le modifiche fatte nell'app TaskForce. Le modifiche fatte tramite l'External API non li attivano.
Payload
Ogni consegna è una POST con un body JSON in questa struttura:
| Campo | Tipo | Descrizione |
|---|---|---|
event | string | Nome dell'evento, inviato anche in X-Webhook-Event. |
timestamp | string | Momento in cui l'evento è stato inviato, ISO 8601 UTC. |
entityType | string | task, project, task-comment o user. |
entityId | integer | ID dell'entità. |
data | object | Istantanea dell'entità. La struttura dipende da entityType. |
Esempio: tasks.completed
{
"event": "tasks.completed",
"timestamp": "2026-09-25T16:42:03+00:00",
"entityType": "task",
"entityId": 1287,
"data": {
"id": 1287,
"sourceId": null,
"startedAt": "2026-09-25T00:00:00.000000Z",
"endAt": "2026-10-03T00:00:00.000000Z",
"createdAt": "2026-09-25T10:15:00.000000Z",
"updatedAt": "2026-09-25T16:42:03.000000Z",
"title": "Write the API reference",
"spentTime": 5400,
"description": "Cover projects, tasks and webhooks.",
"priority": "2",
"effort": 14400,
"typeId": 1,
"parentId": null,
"projectId": 42,
"statusId": 5,
"departmentId": null
}
} data per tipo di entità
| entityType | Campi in data |
|---|---|
task | id, sourceId, startedAt, endAt, createdAt, updatedAt, title, spentTime, description, priority, effort, typeId, parentId, projectId, statusId, departmentId; più assignees, status e project quando caricati. Qui le date includono i microsecondi e priority è una stringa. |
project | id, name, description, logo, statusId, tenantId, users, tasks, sources, comments, startDate, endDate, createdAt, updatedAt. |
task-comment | id, content, commentableType, commentableId, userId, createdAt, updatedAt, user. |
user | id, name, email, isActive, tenantId, image, roles, createdAt, updatedAt. |
Verifica delle firme
| Header | Valore |
|---|---|
Content-Type | application/json |
X-Webhook-Event | Il nome dell'evento, ad esempio tasks.completed. |
X-Webhook-Signature | HMAC-SHA256 esadecimale in minuscolo del body grezzo della richiesta, con chiave il secret condiviso. |
| Firma | |
|---|---|
| Algoritmo | HMAC-SHA256 |
| Codifica | esadecimale (minuscolo, 64 caratteri) |
| Contenuto firmato | I byte esatti del body grezzo della richiesta. Non vengono aggiunti timestamp né prefissi. |
| Chiave | Il secret condiviso che hai inserito alla creazione (o all'ultima rotazione) del webhook. |
- Calcola l'HMAC sul body grezzo prima di interpretare il JSON. Una nuova serializzazione cambia i byte (il body viene inviato con slash e Unicode non escapati).
- Confronta con una funzione a tempo costante.
- La firma non ha timestamp, quindi non protegge dai replay. Se ti interessa, deduplica su
event+entityId+timestamp.
Node.js (Express)
import crypto from "node:crypto";
import express from "express";
const app = express();
// Keep the raw body: the signature covers the exact bytes TaskForce sent.
app.post("/taskforce-webhook", express.raw({ type: "application/json" }), (req, res) => {
const expected = crypto
.createHmac("sha256", process.env.TASKFORCE_WEBHOOK_SECRET)
.update(req.body)
.digest("hex");
const received = req.get("X-Webhook-Signature") ?? "";
const expectedBuf = Buffer.from(expected, "hex");
const receivedBuf = Buffer.from(received, "hex");
const ok =
expectedBuf.length === receivedBuf.length &&
crypto.timingSafeEqual(expectedBuf, receivedBuf);
if (!ok) return res.sendStatus(401);
const event = JSON.parse(req.body.toString("utf8"));
res.sendStatus(204); // acknowledge first, then process
queueForProcessing(event);
}); PHP
<?php
$secret = getenv('TASKFORCE_WEBHOOK_SECRET');
$body = file_get_contents('php://input');
$received = $_SERVER['HTTP_X_WEBHOOK_SIGNATURE'] ?? '';
$expected = hash_hmac('sha256', $body, $secret);
if (!hash_equals($expected, $received)) {
http_response_code(401);
exit;
}
$event = json_decode($body, true);
http_response_code(204);
// process $event['event'], $event['entityId'], $event['data'] ... Consegna e nuovi tentativi
Qualsiasi risposta 2xx. Qualsiasi altra cosa, un timeout o un errore di connessione conta come fallimento e viene ritentata.
- Fino a 5 tentativi in totale: il primo tentativo più 4 nuovi tentativi dopo 30 s, 60 s, 120 s e 240 s.
- Rispondi subito con 2xx ed esegui il lavoro in modo asincrono; i ricevitori lenti raggiungono il timeout di 10 secondi.
- Le consegne sono in coda, quindi l'ordine non è garantito.
- Lo ricevono solo i webhook attivi e non revocati del workspace in cui è avvenuto l'evento.
Avvertenze
- Le scritture fatte tramite l'External API non attivano i webhook. Lo fanno solo le modifiche fatte nell'app (e dai suoi agenti AI).
- users.created e users.updated possono essere selezionati ma al momento non vengono consegnati: gli eventi utente non portano un workspace, quindi vengono saltati.
- projects.archived si attiva quando lo stato di un progetto cambia in 2, che l'app etichetta On hold. Impostare lo stato 6 (Archived nell'app) invia invece projects.updated.
Webhook di chat in ingresso
In Chat, apri un canale normale (non un messaggio diretto) e scegli Webhooks nell'intestazione del canale. Ti serve il permesso di gestione dei canali. Crea un webhook, dagli facoltativamente un nome e copia il secret, l'URL, l'header, l'esempio curl e lo snippet Jenkins, che vengono mostrati una sola volta. Il secret viene memorizzato come hash, quindi se lo perdi, ruotalo. Puoi gestire i webhook anche tramite l'API, vedi sotto.
POST https://app.taskforce.place/api/webhooks/chat/{webhookId} Autenticati con l'header X-Webhook-Secret. Il secret mostrato quando il webhook del canale è stato creato o ruotato l'ultima volta. Viene confrontato con un hash SHA-256, quindi non è mai memorizzato in chiaro.
Body
| Campo | Tipo | Obbligatorio | Descrizione |
|---|---|---|---|
message | string | Sì | Massimo 2000 caratteri. |
title | string | null | No | Massimo 255 caratteri. Mostrato come prima riga. |
status | string | null | No | Massimo 255 caratteri. Mostrato come Status: <value>. |
metadata | object | null | No | Coppie chiave/valore, mostrate come righe key: value sotto Metadata:. |
Limiti
- 60 richieste al minuto, per webhook di canale.
- Body della richiesta fino a 10000 byte.
- Il messaggio formattato (titolo, stato, messaggio e righe dei metadati) deve restare entro 2000 caratteri, altrimenti la richiesta fallisce con 422
Message content too long. - Il messaggio viene pubblicato con il nome del webhook (predefinito
Webhook). - Lo stesso URL è soggetto anche al limite generale di 60 richieste al minuto per IP.
Richiesta
curl -X POST "https://app.taskforce.place/api/webhooks/chat/3f1c2a9e-5b7d-4c1e-9a0f-2d6b8e4f7a13" \
-H "Content-Type: application/json" \
-H "X-Webhook-Secret: $CHANNEL_WEBHOOK_SECRET" \
-d '{"title":"Deploy finished","status":"success","message":"main deployed to production","metadata":{"build":"#482","duration":"3m12s"}}' Risposta (201)
{
"success": true,
"message": "Webhook message delivered",
"data": {
"id": 9051,
"channel_id": 12,
"parent_message_id": null,
"reply_count": 0,
"last_reply_at": null,
"reply_participants": [],
"client_message_id": null,
"user_id": null,
"user": {
"id": null,
"name": "CI bot",
"avatar": null,
"is_bot": false
},
"content": "Deploy finished\nStatus: success\nmain deployed to production\nMetadata:\nbuild: #482\nduration: 3m12s",
"sender_type": "webhook",
"sender_name": "CI bot",
"webhook_id": 3,
"reactions": [],
"attachments": [],
"edited_at": null,
"created_at": "2026-09-25T16:50:00+00:00",
"updated_at": "2026-09-25T16:50:00+00:00",
"channel": null
},
"meta": {}
} Errori
| Stato | message | Quando |
|---|---|---|
| 404 | Webhook not found | ID webhook sconosciuto. |
| 403 | Webhook revoked or disabled | Il webhook è stato revocato o disattivato. |
| 429 | Rate limit exceeded | Più di 60 chiamate in un minuto per questo webhook. Include Retry-After; questo body ha solo success e message. |
| 413 | Payload too large | Body oltre i 10000 byte. |
| 401 | Missing webhook secret | Nessun header X-Webhook-Secret. |
| 401 | Invalid webhook secret | Secret errato. |
| 422 | Invalid payload | Il body non supera la validazione; errors elenca i campi. |
| 422 | Message content too long | Il messaggio formattato supera i 2000 caratteri. |
Gestione dei webhook dei canali
Questi endpoint alimentano la finestra Webhooks in Chat. Si trovano sotto /api/v1/messaging, non /api/v1/external, e si autenticano con un token API utente (Authorization: Bearer <token>). L'utente del token ha bisogno del permesso manage channels e valgono le consuete regole del workspace. Le risposte usano la struttura standard.
- Il secret viene restituito una sola volta, da create e rotate. Sono 64 caratteri esadecimali e viene memorizzato solo il suo hash SHA-256.
- Revoke imposta
is_activea false e valorizzarevoked_at. L'endpoint in ingresso risponde poi 403. Rotate emette un nuovo secret e riattiva anche un webhook revocato. {webhookId}è l'idnumerico, non ilpublic_idusato nell'URL in ingresso.- Errori: 403
Unauthorizedsenza permesso, 404Webhook not foundper un id sconosciuto in quel canale, 422 per un body non valido.
/api/v1/messaging/channels/{channelId}/webhooks Scope: manage channels
Elenca i webhook del canale, dal più recente. I secret non sono mai inclusi.
Parametri di percorso
| Nome | Tipo | Obbligatorio | Descrizione |
|---|---|---|---|
channelId | integer | Sì | L'ID del canale. |
Richiesta
curl "https://app.taskforce.place/api/v1/messaging/channels/12/webhooks" \
-H "Authorization: Bearer $TASKFORCE_TOKEN" Risposta
{
"success": true,
"message": "",
"data": [
{
"id": 3,
"public_id": "3f1c2a9e-5b7d-4c1e-9a0f-2d6b8e4f7a13",
"channel_id": 12,
"name": "CI bot",
"is_active": true,
"revoked_at": null,
"created_by": 7,
"created_at": "2026-09-25T16:40:00+00:00",
"updated_at": "2026-09-25T16:40:00+00:00",
"url": "https://app.taskforce.place/api/webhooks/chat/3f1c2a9e-5b7d-4c1e-9a0f-2d6b8e4f7a13"
}
]
} /api/v1/messaging/channels/{channelId}/webhooks Scope: manage channels
Crea un webhook. Restituisce 201 con il webhook e il suo secret, mostrato una sola volta.
Parametri di percorso
| Nome | Tipo | Obbligatorio | Descrizione |
|---|---|---|---|
channelId | integer | Sì | L'ID del canale. |
Body
| Nome | Tipo | Obbligatorio | Descrizione |
|---|---|---|---|
name | string | null | No | Massimo 255 caratteri. Usato come nome del mittente dei messaggi pubblicati; Webhook se vuoto. |
Richiesta
curl -X POST "https://app.taskforce.place/api/v1/messaging/channels/12/webhooks" \
-H "Authorization: Bearer $TASKFORCE_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"CI bot"}' Risposta
{
"success": true,
"message": "Channel webhook created successfully",
"data": {
"webhook": {
"id": 3,
"public_id": "3f1c2a9e-5b7d-4c1e-9a0f-2d6b8e4f7a13",
"channel_id": 12,
"name": "CI bot",
"is_active": true,
"revoked_at": null,
"created_by": 7,
"created_at": "2026-09-25T16:40:00+00:00",
"updated_at": "2026-09-25T16:40:00+00:00",
"url": "https://app.taskforce.place/api/webhooks/chat/3f1c2a9e-5b7d-4c1e-9a0f-2d6b8e4f7a13"
},
"secret": "9b1d...64 hex characters...e07a",
"secretHeader": "X-Webhook-Secret",
"exampleCurl": "curl -X POST '<url>' -H 'Content-Type: application/json' -H 'X-Webhook-Secret: <secret>' -d '{...}'",
"jenkinsSnippet": "pipeline { ... }"
}
} /api/v1/messaging/channels/{channelId}/webhooks/{webhookId}/rotate Scope: manage channels
Sostituisce il secret. Il vecchio secret smette di funzionare subito. Riattiva anche un webhook revocato. Nessun body.
Parametri di percorso
| Nome | Tipo | Obbligatorio | Descrizione |
|---|---|---|---|
channelId | integer | Sì | L'ID del canale. |
webhookId | integer | Sì | L'ID numerico del webhook. |
Richiesta
curl -X POST "https://app.taskforce.place/api/v1/messaging/channels/12/webhooks/3/rotate" \
-H "Authorization: Bearer $TASKFORCE_TOKEN" Risposta
{
"success": true,
"message": "Channel webhook rotated successfully",
"data": {
"webhook": {
"id": 3,
"public_id": "3f1c2a9e-5b7d-4c1e-9a0f-2d6b8e4f7a13",
"channel_id": 12,
"name": "CI bot",
"is_active": true,
"revoked_at": null,
"created_by": 7,
"created_at": "2026-09-25T16:40:00+00:00",
"updated_at": "2026-09-25T16:40:00+00:00",
"url": "https://app.taskforce.place/api/webhooks/chat/3f1c2a9e-5b7d-4c1e-9a0f-2d6b8e4f7a13"
},
"secret": "9b1d...64 hex characters...e07a",
"secretHeader": "X-Webhook-Secret",
"exampleCurl": "curl -X POST '<url>' -H 'Content-Type: application/json' -H 'X-Webhook-Secret: <secret>' -d '{...}'",
"jenkinsSnippet": "pipeline { ... }"
}
} /api/v1/messaging/channels/{channelId}/webhooks/{webhookId}/revoke Scope: manage channels
Disattiva il webhook. Restituisce il webhook con `is_active` false e `revoked_at` valorizzato. Nessun body.
Parametri di percorso
| Nome | Tipo | Obbligatorio | Descrizione |
|---|---|---|---|
channelId | integer | Sì | L'ID del canale. |
webhookId | integer | Sì | L'ID numerico del webhook. |
Richiesta
curl -X POST "https://app.taskforce.place/api/v1/messaging/channels/12/webhooks/3/revoke" \
-H "Authorization: Bearer $TASKFORCE_TOKEN" Risposta
{
"success": true,
"message": "Channel webhook revoked successfully",
"data": {
"id": 3,
"public_id": "3f1c2a9e-5b7d-4c1e-9a0f-2d6b8e4f7a13",
"channel_id": 12,
"name": "CI bot",
"is_active": false,
"revoked_at": "2026-09-26T09:00:00+00:00",
"created_by": 7,
"created_at": "2026-09-25T16:40:00+00:00",
"updated_at": "2026-09-25T16:40:00+00:00",
"url": "https://app.taskforce.place/api/webhooks/chat/3f1c2a9e-5b7d-4c1e-9a0f-2d6b8e4f7a13"
}
} Per pubblicare da Jenkins, vedi Notifiche di deploy con Jenkins.