Webhook After Certificate Validation
Steps to Follow
To configure your webhook, please follow the instructions below:
- Send the endpoint URL: Please provide us with a URL of your endpoint capable of receiving POST requests.
- Send authentication information: You must provide us with either a Bearer
authToken, or a combination ofapiKeyandapiSecretKey, or a username and password forBasicauthentication. This information will be used to secure communications between our systems. - Design the token reception: Ensure that your endpoint is capable of receiving the authentication token in the request header. The
authTokenwill be sent in theAuthorizationheader asBearer <authToken>. If you use a combination ofapiKeyandapiSecretKey, the headers and request signature will be structured as follows:
- For Bearer Token:
Authorization: Bearer <authToken>
Content-Type: application/json
- For authentication with
apiKeyandapiSecretKey:
An HMAC-SHA256 signature will be used with the request data to secure authentication. Here is an example of signature generation and request headers:
const data = JSON.stringify(requestBody); // requestBody is the request content
const signature = this.encryptionService.encryptHmacSha256(data, this.credentials.apiSecretKey);
const headers = {
Authorization: 'HMAC-SHA256 ' + this.credentials.apiKey + ':' + signature,
'X-Api-Key': this.credentials.apiKey,
'Content-Type': 'application/json',
};
And here is the example of HTTP headers you need to implement on your endpoint:
Authorization: HMAC-SHA256 <apiKey>:<signature>
X-Api-Key: <your_api_key>
Content-Type: application/json
DTO
The ShareCasesWithMetaDatasDto DTO is designed to represent a data structure containing detailed information about a particular certificate and a list of elements associated with that certificate. Here are the main components of this DTO:
cfRef(String): A unique reference for the certificate, serving as an identifier.reportId(String): The identifier of the report associated with the certificate.caseUrl(URL): The URL to a streamable PDF file linked to the certificate.createdAt(ISO8601): The date and time of case creation, formatted according to the ISO8601 standard.items(Array ofBaseItemDto): A list of elements associated with the certificate, where each element is represented by an instance ofBaseItemDto.
Each BaseItemDto in the items list contains the following information:
createdAt(ISO8601): The date and time of element creation.cfRef(String): A unique reference for the element.description(String): A description of the element.geolocLatitudeandgeolocLongitude(String): The geographic coordinates of the element.data(String): The content of the element if it is of typeDATE_FIELD,EMAIL,NUMBER_FIELD,TEXT_FIELDorTIME, the image title if it is of typePHOTOGRAPHYimageUrl(URL, optional): The URL to a streamable PNG/JPG image associated with the element.StepActionenum: The element type, specified by aStepActionenumeration that includes values likeDATE_FIELD,EMAIL,NUMBER_FIELD,PHOTOGRAPHY,TEXT_FIELD,TIME.
class ItemDto {
@IsISO8601()
createdAt: Date;
@IsString()
cfRef: string;
@IsString()
description: string;
@IsString()
geolocLatitude: string;
@IsString()
geolocLongitude: string;
@IsOptional()
@IsUrl()
imageUrl?: string; // url to get streamableFile
@IsEnum(StepAction)
stepAction: StepAction;
}
export class CaseForApiResponseDto {
@IsString()
cfRef: string;
@IsISO8601()
createdAt: Date;
@IsString()
reportId: string;
@IsString()
frame: string;
@IsBoolean()
closed: boolean;
@IsUrl()
caseUrl: string;
@IsArray()
@Type(() => ItemDto)
items: ItemDto[];
}
enum StepAction {
DateField = 'DATE_FIELD',
Email = 'EMAIL',
NumberField = 'NUMBER_FIELD',
Photography = 'PHOTOGRAPHY',
Video = 'VIDEO',
TextField = 'TEXT_FIELD',
Time = 'TIME',
Select = 'SELECT',
Singature = 'SIGNATURE'
}