Webhooks can be considered as “reverse APIs”: instead of our platform proactively reading the information, it is the data source that sends the data to our platform and we insert it from the webhook to the Data Warehouse.
Adding the data source
3) With the data source added, go to the pipelines section and click on “New pipeline”
4) Follow the normal flow of creating pipelines, selecting the new webhooks data source as the source
5) Once the pipeline has been created, access it and, in your browser's address bar, copy the pipeline id, which is the numeric code at the end of “app.kondado.com.br/pipelines/XXXX”
Sending information to your Webhook
Your new webhook accepts POST type requests and will send the body of the call to your destination, which must be a JSON type.
Your webhook address is composed as follows:
Base URL
https://k1.kondado.com.br
Mandatory Parameters
pipeline_id: your pipeline ID, obtained in step (5)
key: key of your token, obtained in step (1)
token: your token, obtained in step (2)
URL Example
Combining the base URL and parameters, your call will look like this:
https://k1.kondado.com.br?pipeline_id=835212&token=oseutokenaqui&key=achavedoseutokenaqui
With your URL created, just add it to your tool or application and make posts in it with the body you want to send to your datawarehouse.
ATTENTION: Be careful not to confuse token and key when adding them in the URL. To differentiate them more easily, remember that the key will have a format with hyphens, such as “d538b946-9d55-405a-9bd2-72d74b1cb8f5” and the token will be a long sequence of numbers and letters, but without hyphens
See an example of using webhooks
Webhook Response Codes
The URL response will return code 200 on success and 400 on failure. In the response there will be a JSON, the format of which can be:
Insert Successful
The successful insertion will return a JSON in the format below, where the variable “success” will come as true and there will be another variable “data”, which contains information about the request.
{
"success": true,
"data": {
"__kdd_request_id": "rydjemeilmsqkqvjtfkc",
"__kdd_request_unix_timestamp": 1577015690.3118637
}
}
__kdd_request_id: id of the webhook run, which will be inserted into your data warehouse
__kdd_request_unix_timestamp: UNIX timestamp (in UTC) that indicates when the request happened. It will also be inserted into your data warehouse
You can use the variables sent in “data” to keep some kind of log in your application.
Successful insertion does not mean that your data will be processed. After receiving a successful response, the data will still go through an authentication validation in a second moment and the negative authentication response will not be returned – the data will just be discarded. You will be able to check the positive response once the data is entered at your destination.
Insertion Failed
The unsuccessful insertion returns a JSON like the one below, where “success” will be false and the “error” variable will bring the error code found.
{
"success": false,
"error": "ERROR_CODE"
}
Error codes and their meanings:
MISSING_PARAMETER: parameter_key.Indicates that the URL is badly formatted and the parameter indicated by parameter_key was not provided (recalling that the pipeline_id, key and token parameters are mandatory)
INVALID_PARAMETER: parameter_key. the parameter value entered is invalid
NO_PARAMETERS_PROVIDED. Indicates that the URL is badly formatted and no parameters were provided
NO_BODY_PROVIDED. Indicates that nobody was supplied during POST
Pipelines
Relationship Chart
post raw JSON
- __kdd_request_body will receive the JSON of the post