Webhooks

Webhooks

Webhooks notify your application in real-time when events occur in GSMtasks, via an HTTP POST to the URL you specify.

You can configure webhooks from the Account settings area in the GSMtasks web application or via the Webhooks API.

Event types

Enable one or more event types on each webhook.

Event typeTopic headerDescription
Task eventstaskevent.createTask state changes and updates (create, assign, complete, etc.)
Documentsdocument.createImages, videos, or other documents attached to a task
Signaturessignature.createSignature images attached to a task
Reviewsreview.createReviews from trackers

For task events, you can optionally filter which actions trigger the webhook (e.g. only complete and fail). If no filter is set, all task event types are sent.

HTTP delivery

Each webhook delivery is an HTTP POST with a JSON body.

Headers

HeaderDescription
Content-Typeapplication/json
X-GSMtasks-TopicEvent topic (e.g. taskevent.create, document.create)
X-GSMtasks-AccountAccount UUID
X-GSMtasks-API-VersionWebhook API version (e.g. 2.6.0)
X-GSMtasks-Hmac-SHA256Base64-encoded HMAC-SHA256 signature
X-GSMtasks-Webhook-Request-IdUnique request UUID

Custom headers configured on the webhook are also included.

Verifying signatures

Every webhook has a shared_secret generated on creation. Use it to verify that requests originate from GSMtasks by computing the HMAC-SHA256 of the raw request body and comparing it with the X-GSMtasks-Hmac-SHA256 header.

const crypto = require('crypto')
 
function verifyWebhook(sharedSecret, requestBody, signatureHeader) {
  const hmac = crypto.createHmac('sha256', sharedSecret)
  hmac.update(requestBody)
  const expected = hmac.digest('base64')
  return expected === signatureHeader
}

Retries

Failed deliveries are retried up to 10 times with exponential backoff. The delay between retries follows the formula (attempt + 1)² × 16 seconds.

If all retries are exhausted, the webhook is marked as failed and an email notification is sent to the account owner.

💡

A failed webhook stops sending events until it is manually reactivated from the account settings.

Payload schemas

All payloads include hyperlinked URLs to related resources. The task field is inlined as a full object for task events (API version 2.0.0+) and for document/signature events (API version 2.6.0+).

Task event payload

Sent when a task state change or update occurs.

FieldTypeDescription
idUUIDTask event ID
urlURLTask event resource URL
accountURLAccount resource URL
taskObjectFull task object (inlined)
task_commandURLRelated task command URL
fieldStringChanged field (state or assignee_proximity)
eventStringEvent action (see table below)
from_stateStringPrevious state value
to_stateStringNew state value
userURL | nullUser who triggered the event
notesStringOptional notes
locationGeoJSON | nullLocation where the event occurred
assigneeURL | nullAssigned user URL
created_atDateTimeISO 8601 timestamp
updated_atDateTimeISO 8601 timestamp

Task event actions

ActionDescription
createTask created
assignTask assigned to a worker
acceptWorker accepted the task
rejectWorker rejected the assignment
unassignTask unassigned from worker
transitWorker traveling to location
activateWorker began work on the task
completeTask completed
failTask failed
cancelTask cancelled
restartFailed task restarted

Example

{
  "id": "a3b2c1d4-e5f6-7890-abcd-ef0123456789",
  "url": "https://api.gsmtasks.com/task_events/a3b2c1d4-e5f6-7890-abcd-ef0123456789/",
  "account": "https://api.gsmtasks.com/accounts/a6f60fdf-d87b-4c5d-b5ec-67a90cd16236/",
  "task": {
    "id": "e9ba6977-ddc4-41b9-b90b-1ae9b37b3c05",
    "url": "https://api.gsmtasks.com/tasks/e9ba6977-ddc4-41b9-b90b-1ae9b37b3c05/",
    "account": "https://api.gsmtasks.com/accounts/a6f60fdf-d87b-4c5d-b5ec-67a90cd16236/",
    "external_id": "order-12345",
    "reference": "REF-001",
    "barcodes": [],
    "category": "assignment",
    "contact": {
      "name": "John Smith",
      "company": "ACME Corp",
      "phones": ["+3725551234"],
      "emails": ["john@example.com"],
      "notes": ""
    },
    "orderer_name": "ACME Corp",
    "contact_address": null,
    "contact_address_external_id": null,
    "state": "completed",
    "assignee": "https://api.gsmtasks.com/users/8495e730-e5c2-400c-8ffc-ad830d4fa6a2/",
    "order": "https://api.gsmtasks.com/orders/d4e5f6a7-b8c9-0123-4567-890abcdef012/",
    "route": "https://api.gsmtasks.com/routes/f6a7b8c9-d0e1-2345-6789-0abcdef01234/",
    "description": "Deliver package to customer",
    "calendar_time": null,
    "complete_after": "2024-03-15T08:00:00+02:00",
    "complete_before": "2024-03-15T12:00:00+02:00",
    "scheduled_time": "2024-03-15T09:00:00+02:00",
    "completed_at": "2024-03-15T09:42:00+02:00",
    "cancelled_at": null,
    "auto_assign": false,
    "assignee_proximity": "away",
    "position": 16343544103.78,
    "priority": 0,
    "duration": "00:30:00",
    "size": null,
    "address": {
      "raw_address": "123 Main Street, Tallinn, Estonia",
      "formatted_address": "123 Main Street, Tallinn, Estonia",
      "location": {
        "type": "Point",
        "coordinates": [24.7536, 59.437]
      }
    },
    "forms": {},
    "documents": [],
    "signatures": [],
    "signers": [],
    "metafields": {},
    "trackers": [],
    "recurrence": null,
    "issues": [],
    "counts": {},
    "actions": ["unassign", "cancel"],
    "created_by": "https://api.gsmtasks.com/users/8495e730-e5c2-400c-8ffc-ad830d4fa6a2/",
    "created_at": "2024-03-14T14:00:00+02:00",
    "updated_at": "2024-03-15T09:42:00+02:00"
  },
  "task_command": "https://api.gsmtasks.com/task_commands/856ae165-9595-4f1d-8377-6f4c4db073d1/",
  "field": "state",
  "event": "complete",
  "from_state": "active",
  "to_state": "completed",
  "user": "https://api.gsmtasks.com/users/8495e730-e5c2-400c-8ffc-ad830d4fa6a2/",
  "notes": "",
  "location": {
    "type": "Point",
    "coordinates": [24.7536, 59.437]
  },
  "assignee": "https://api.gsmtasks.com/users/8495e730-e5c2-400c-8ffc-ad830d4fa6a2/",
  "created_at": "2024-03-15T09:42:00+02:00",
  "updated_at": "2024-03-15T09:42:00+02:00"
}
💡

The inlined task object contains the same fields as the Tasks API. Some fields may be absent depending on the webhook’s configured API version.

Document payload

Sent when a document is attached to a task.

FieldTypeDescription
idUUIDDocument ID
urlURLDocument resource URL
accountURLAccount resource URL
external_idString | nullExternal identifier
orderURL | nullRelated order URL
taskObjectFull task object (inlined in API version 2.6.0+)
recurrenceURL | nullRelated recurrence URL
contact_addressURL | nullRelated contact address URL
fileURLFile download URL
file_nameStringOriginal file name
mimetypeStringFile MIME type (e.g. image/jpeg)
thumbnailURLThumbnail image URL
descriptionStringDocument description
created_byURLUser who created the document
sourceStringDocument source
visible_to_workerBooleanVisible to assigned worker
visible_to_clientBooleanVisible to client
created_atDateTimeISO 8601 timestamp
updated_atDateTimeISO 8601 timestamp

Example

{
  "id": "b4c5d6e7-f8a9-0123-4567-890abcdef012",
  "url": "https://api.gsmtasks.com/documents/b4c5d6e7-f8a9-0123-4567-890abcdef012/",
  "account": "https://api.gsmtasks.com/accounts/a6f60fdf-d87b-4c5d-b5ec-67a90cd16236/",
  "external_id": null,
  "order": "https://api.gsmtasks.com/orders/d4e5f6a7-b8c9-0123-4567-890abcdef012/",
  "task": {
    "id": "e9ba6977-ddc4-41b9-b90b-1ae9b37b3c05",
    "url": "https://api.gsmtasks.com/tasks/e9ba6977-ddc4-41b9-b90b-1ae9b37b3c05/",
    "state": "completed",
    "external_id": "order-12345",
    "description": "Deliver package to customer"
  },
  "recurrence": null,
  "contact_address": null,
  "file": "https://files.gsmtasks.com/documents/photo-12345.jpg",
  "file_name": "delivery-proof.jpg",
  "mimetype": "image/jpeg",
  "thumbnail": "https://files.gsmtasks.com/thumbnails/photo-12345.jpg",
  "description": "Proof of delivery",
  "created_by": "https://api.gsmtasks.com/users/8495e730-e5c2-400c-8ffc-ad830d4fa6a2/",
  "source": "mobile",
  "visible_to_worker": true,
  "visible_to_client": false,
  "created_at": "2024-03-15T09:43:00+02:00",
  "updated_at": "2024-03-15T09:43:00+02:00"
}

Signature payload

Sent when a signature is captured on a task.

FieldTypeDescription
idUUIDSignature ID
urlURLSignature resource URL
accountURLAccount resource URL
external_idString | nullExternal identifier
taskObjectFull task object (inlined in API version 2.6.0+)
fileURLSignature image URL
file_nameStringFile name
mimetypeStringFile MIME type
thumbnailURLThumbnail URL
signerObjectContact who signed (see below)
documentsObject[]Related document objects (full document data)
locationGeoJSON | nullLocation where signature was captured
created_byURLUser who captured the signature
sourceStringSignature source
created_atDateTimeISO 8601 timestamp
updated_atDateTimeISO 8601 timestamp

Signer object

FieldTypeDescription
nameStringSigner name
companyString | nullCompany name
phonesString[]Phone numbers
emailsString[]Email addresses
notesStringNotes

Example

{
  "id": "c5d6e7f8-a9b0-1234-5678-90abcdef0123",
  "url": "https://api.gsmtasks.com/signatures/c5d6e7f8-a9b0-1234-5678-90abcdef0123/",
  "account": "https://api.gsmtasks.com/accounts/a6f60fdf-d87b-4c5d-b5ec-67a90cd16236/",
  "external_id": null,
  "task": {
    "id": "e9ba6977-ddc4-41b9-b90b-1ae9b37b3c05",
    "url": "https://api.gsmtasks.com/tasks/e9ba6977-ddc4-41b9-b90b-1ae9b37b3c05/",
    "state": "completed",
    "external_id": "order-12345",
    "description": "Deliver package to customer"
  },
  "file": "https://files.gsmtasks.com/signatures/sig-12345.png",
  "file_name": "signature.png",
  "mimetype": "image/png",
  "thumbnail": "https://files.gsmtasks.com/thumbnails/sig-12345.png",
  "signer": {
    "name": "John Smith",
    "company": "ACME Corp",
    "phones": ["+3725551234"],
    "emails": ["john@example.com"],
    "notes": ""
  },
  "documents": [
    {
      "id": "b4c5d6e7-f8a9-0123-4567-890abcdef012",
      "url": "https://api.gsmtasks.com/documents/b4c5d6e7-f8a9-0123-4567-890abcdef012/",
      "account": "https://api.gsmtasks.com/accounts/a6f60fdf-d87b-4c5d-b5ec-67a90cd16236/",
      "file": "https://files.gsmtasks.com/documents/photo-12345.jpg",
      "file_name": "delivery-proof.jpg",
      "mimetype": "image/jpeg",
      "description": "Proof of delivery"
    }
  ],
  "location": {
    "type": "Point",
    "coordinates": [24.7536, 59.437]
  },
  "created_by": "https://api.gsmtasks.com/users/8495e730-e5c2-400c-8ffc-ad830d4fa6a2/",
  "source": "mobile",
  "created_at": "2024-03-15T09:44:00+02:00",
  "updated_at": "2024-03-15T09:44:00+02:00"
}

Review payload

Sent when a tracker submits a review.

FieldTypeDescription
idUUIDReview ID
accountURLAccount resource URL
trackerURLTracker resource URL
ratingIntegerRating value
commentString | nullReview comment
last_taskURLMost recent task URL
last_assigneeURLMost recent assignee URL
created_atDateTimeISO 8601 timestamp

Example

{
  "id": "e7f8a9b0-c1d2-3456-7890-abcdef012345",
  "account": "https://api.gsmtasks.com/accounts/a6f60fdf-d87b-4c5d-b5ec-67a90cd16236/",
  "tracker": "https://api.gsmtasks.com/trackers/f8a9b0c1-d2e3-4567-8901-bcdef0123456/",
  "rating": 5,
  "comment": "Great service, very professional",
  "last_task": "https://api.gsmtasks.com/tasks/e9ba6977-ddc4-41b9-b90b-1ae9b37b3c05/",
  "last_assignee": "https://api.gsmtasks.com/account_roles/a9b0c1d2-e3f4-5678-9012-cdef01234567/",
  "created_at": "2024-03-15T10:00:00+02:00"
}