Skip to main content

Webhook After Certificate Validation

Steps to Follow

To configure your webhook, please follow the instructions below:

  1. Send the endpoint URL: Please provide us with a URL of your endpoint capable of receiving POST requests.
  2. Send authentication information: You must provide us with either a Bearer authToken, or a combination of apiKey and apiSecretKey, or a username and password for Basic authentication. This information will be used to secure communications between our systems.
  3. Design the token reception: Ensure that your endpoint is capable of receiving the authentication token in the request header. The authToken will be sent in the Authorization header as Bearer <authToken>. If you use a combination of apiKey and apiSecretKey, the headers and request signature will be structured as follows:
  • For Bearer Token:
Authorization: Bearer <authToken>
Content-Type: application/json

  • For authentication with apiKey and apiSecretKey:

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 of BaseItemDto): A list of elements associated with the certificate, where each element is represented by an instance of BaseItemDto.

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.
  • geolocLatitude and geolocLongitude (String): The geographic coordinates of the element.
  • data (String): The content of the element if it is of type DATE_FIELD, EMAIL, NUMBER_FIELD, TEXT_FIELD or TIME, the image title if it is of type PHOTOGRAPHY
  • imageUrl (URL, optional): The URL to a streamable PNG/JPG image associated with the element.
  • StepAction enum: The element type, specified by a StepAction enumeration that includes values like DATE_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'
}