List webhooks
const url = 'https://api.sendtruss.com/v1/webhooks?state=pending&type=message.delivered';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://api.sendtruss.com/v1/webhooks?state=pending&type=message.delivered' \ --header 'Authorization: Bearer <token>'Every webhook of the last 30 days, newest first, 50 to a page, with its delivery state, attempts and last error: the place to look when one didn’t arrive.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”Only the webhooks for this endpoint, by its id.
Every webhook type an endpoint can ask for. Any other type is refused with unknown_type.
Only the webhooks about this workspace, by our id or as ref: plus your reference.
Responses
Section titled “Responses”Paginated set of WebhookResource
object
object
Where the change came from: recipient when the person did it, such as leaving marketing or marking an email as spam; sendtruss when our sending or our own rules recorded it.
object
pending until your endpoint answers 2xx (delivered) or we give up (failed).
The HTTP status your endpoint last answered with, or null when it gave none.
What went wrong on the last attempt, or null.
object
object
Base path for paginator generated URLs.
Number of items shown per page.
The “cursor” that points to the next set of items.
The “cursor” that points to the previous set of items.
Examplegenerated
{ "data": [ { "id": "example", "type": "example", "source": "example", "endpoint_id": "example", "workspace": { "id": "example", "reference": "example" }, "state": "example", "attempts": 1, "last_attempt_at": "example", "last_status": 1, "last_error": "example", "delivered_at": "example", "created_at": "example", "body": "example" } ], "links": { "first": "example", "last": "example", "prev": "example", "next": "example" }, "meta": { "path": "example", "per_page": 1, "next_cursor": "example", "prev_cursor": "example" }}Headers
Section titled “Headers”This request’s id. Quote it when you ask us about the request.
The API key is missing, malformed, revoked or expired.
object
What went wrong, for a person to read. It may change, so branch on code.
What went wrong, for your code to branch on. A new code is not a breaking change.
The entry on our errors page that explains this code.
This request’s id, the same as its Request-Id header. Quote it when you ask us about the request.
Example
{ "code": "unauthenticated"}Headers
Section titled “Headers”This request’s id. Quote it when you ask us about the request.
The request is invalid. The code says why, and errors names each field at fault.
object
What went wrong, for a person to read. It may change, so branch on code.
What went wrong, for your code to branch on. A new code is not a breaking change.
Each field that failed validation, by its path in the request, with its messages.
object
The entry on our errors page that explains this code.
This request’s id, the same as its Request-Id header. Quote it when you ask us about the request.
Example
{ "code": "validation_failed"}Headers
Section titled “Headers”This request’s id. Quote it when you ask us about the request.
Too many requests. Wait for the seconds in Retry-After.
object
What went wrong, for a person to read. It may change, so branch on code.
What went wrong, for your code to branch on. A new code is not a breaking change.
The entry on our errors page that explains this code.
This request’s id, the same as its Request-Id header. Quote it when you ask us about the request.
Example
{ "code": "rate_limited"}Headers
Section titled “Headers”This request’s id. Quote it when you ask us about the request.
Seconds to wait before trying again.