Add a webhook

POST /webhooks

This endpoint add a new webhook. It returns the webhook object.

application/json

Body Required

  • targetUrl string Required

    The URL of the webhook endpoint.

  • types array[string]

    The list of events to enable for this endpoint.

    Values are created, statusChanged, portalSubmited, dueDateChanged, portalViewed, docUploaded, docDeleted, itemApproved, itemRejected, itemReopened, itemCancelValidation, formSubmited, emailSent, emailClicked, emailBounced, emailOpened, emailMarkedAsSpam, emailBlocked, emailUnsub, smsSent, smsDelivered, smsClicked, smsFailed, or smsUndelivered.

  • We'll call this endpoint only for this campaignId.

  • If you specify a secret token, it will be sent with the hook request in the HTTP header.

Responses

  • 200 application/json

    Success

    Hide response attributes Show response attributes object
    • _id string
    • status string
    • createdAt string(date-time)
    • types array[string]

      Values are created, statusChanged, portalSubmited, dueDateChanged, portalViewed, docUploaded, docDeleted, itemApproved, itemRejected, itemReopened, itemCancelValidation, formSubmited, emailSent, emailClicked, emailBounced, emailOpened, emailMarkedAsSpam, emailBlocked, emailUnsub, smsSent, smsDelivered, smsClicked, smsFailed, or smsUndelivered.

    • We'll call this endpoint only for this campaignId.

    • If you specify a secret token, it will be sent with the hook request in the HTTP header.

  • 400

    Bad Request -- Your request is invalid.

  • 401

    Unauthorized -- Your API key is wrong.

  • 403

    Forbidden -- The object requested is hidden for administrators only.

  • 404

    Not Found -- The specified object could not be found.

  • 429

    Too Many Requests -- You're requesting too many objects! Slow down!

  • 500

    Internal Server Error -- We had a problem with our server. Try again later.

  • 503

    Service Unavailable -- We're temporarily offline for maintenance. Please try again later.

POST /webhooks
curl \
 -X POST https://api.usecollect.com/v1/webhooks \
 --user "username:password" \
 -H "Content-Type: application/json" \
 -d '{"targetUrl":"https://yourserver.com/collect-hook","types":["created","statusChanged","dueDateChanged"],"campaignId":"sGyGrNPDxQDy6ZRAm"}'
Request example
{
  "targetUrl": "https://yourserver.com/collect-hook",
  "types": [
    "created",
    "statusChanged",
    "dueDateChanged"
  ],
  "campaignId": "sGyGrNPDxQDy6ZRAm"
}
Response examples (200)
{
  "_id": "eqQkPdnqwN7J38QEx",
  "targetUrl": "https://yourserver.com/collect-hook",
  "status": "active",
  "types": [
    "created",
    "statusChanged",
    "dueDateChanged"
  ],
  "createdAt": "2022-07-13 15:01:38 UTC"
}