Create callback

Written by Анатолій
Updated 5 days ago

To create a new callback record, you should use the next request:

Method Request URL*
POST /api/v1/envelope/callback/add

Create callback

URL

Method

POST

request URL

/api/v1/envelope/callback/add

Headers

content-type

application/json

authorization

Bearer {token} where {token} is the authorisation token that which user received after successful authorisation on the platform

mailbox

UUID of the mailbox to which you configured callbacks

REQUEST BODY

{
  "filter": {
      "label": ["string"],
      "status": ["COMPLETED"],
      "subject": "string",
      "receiveDateFrom": "2023-02-16T12:34:26.606Z",
      "receiveDateTo": "2023-02-16T12:34:26.606Z",
      "expireDateFrom": "2023-02-16T12:34:26.606Z",
      "expireDateTo": "2023-02-16T12:34:26.606Z",
      "template": ["3fa85f64-5717-4562-b3fc-2c963f66afa6"],
      "sender": ["3fa85f64-5717-4562-b3fc-2c963f66afa6"],
      "scope": ["inbox"]
  },
  "url": "string",
  "retries": 10,
  "timeout": 60000,
  "successCode": 200,
  "login": "string",
  "password": "string"
}

Request body parameters are described below:

filter *

It is an object with a filter that determines which callbacks will be triggered. Can be empty if you don’t want to use any filters

label

Filter envelopes by a label assigned to the envelope

status

Filter envelopes by status. Allowed statuses for callbacks are WAITING, COMPLETED, CANCELLED, EXPIRED (case insensitive)

subject

Filter envelopes by the respective subject of the envelope. The filter works according to the content rule. It means if we apply a filter by subject 'agreement', all envelopes with the word “agreement” will be added to the callback queue and a callback will be sent.

receiveDateFrom

Filter envelopes by receive date FROM the specified date and time

receiveDateTo

Filter envelopes by receive date TO the specified date and time

expireDateFrom

Filter envelopes by envelope expiration date FROM the specified date and time

expireDateTo

Filter envelopes by envelope expiration date TO the specified date and time

template

Filter envelopes specific template (template from which the envelope was created). Allowed values are template UUIDs

sender

Filter envelopes by envelope sender. Allowed values are the sender's UUID

scope

Filter envelopes by direction of the email. Allowed values are inbox and outbox (case insensitive)

url *

The parameter defines the URL where the callback will be sent

retries *

The parameter defines the quantity of callbacks sent to retire. Retries could be applied if the URL is unreachable or the success code received from the URL is different from the expected. Allowed values from 0 to 10. If a 0 value is set in the callback, it means that the system tries to send the callback once and will not retry

timeout *

The parameter defines a timeout in milliseconds which the system waits for a response with a success code. If the timeout is reached, the retry procedure starts (if configured). Allowed values from 100 to 60000

successCode

The parameter defines the status code that which system waits for a successfully sent callback. If the status code received from the URL is different from the required retries procedure will be initiated (if configured). If no default value (Status code: 200) will be applied.

login

The parameter defines the login of the Basic auth (if the URL is reachable only with Basic auth, this parameter has to be defined)

password

The parameter defines the password of the basic auth (if the URL is reachable only with Basic auth, this parameter has to be defined)

* - defines attribute as required

RESPONSE

In response, you get a 201 status code (in case of successful callback creation) and JSON data of the callback

Response example (JSON):

{
  "id": "f8c97405-9185-4998-a3c0-2c4d0edaf43b",
  "filter": {
      "label": ["string"],
      "status": ["COMPLETED"],
      "subject": "string",
      "receiveDateFrom": null,
      "receiveDateTo": null,
      "expireDateFrom": null,
      "expireDateTo": null,
      "template": ["3fa85f64-5717-4562-b3fc-2c963f66afa6"],
      "sender": ["3fa85f64-5717-4562-b3fc-2c963f66afa6"],
      "scope": ["inbox"]
  },
  "url": "string",
  "retries": 10,
  "timeout": 60000,
  "successCode": 200,
  "authType": "BASIC"
}
Did this answer your question?