Los webhooks permiten conocer el estado de diferentes eventos relacionados con los procesos de los documentos, los cuales no tienen un tiempo determinado para dar una respuesta. De esta manera, se pueden programar eventos que permitan conocer cuando estos procesos finalicen, a través de la configuración que el usuario provea.
Tipos de webhook de documentos
A continuación, se enlista los eventos relacionados al documentos desde que se envía a firma hasta cuando se completa.
Nombre | Descripción |
---|---|
sendDocument | Se detona cuando el documento es enviado a firma desde plataforma, o mediante en el endpoint de Enviar documento a firma |
completedDocument | El evento se detona cuando el documento es firmado por todos los participantes en el proceso de firma |
signDocument | El evento se detona cada vez que un participante firma el documento. Ejemplo: Si son 3 participantes se estaría enviado 3 eventos sobre el mismo documento. |
pendingBiometric | El evento se detona cada vez que se procesa una verificación de identidad y pasa por un proceso manual para verificación |
failedBiometric | El evento se detona cada vez que al procesar la verificación de identidad falla por alguna validación |
failedBiometricRequest | El evento se detona cuando la petición contiene una imagen con problemas para procesarse |
Flujo de trabajo con webhooks
Agregar un webhook
Aquí mostraremos como hacer el registro de un webhook usando los tipos de webhook de documentos, para los ejemplos usaremos https://webhook.site/ que permite poder escuchar eventos usando webhook's.
Petición
curl --location --request POST 'https://api-sandbox.weetrust.com.mx/webhooks?url=https://webhook.site/2424c940-1a2b-49bc-b2c8-b07ca0196c8c&type=completedDocument' \
--header 'user-id: [USER_ID]' \
--header 'token: [ACCESS_TOKEN]'
Respuesta
{
"responseData": {
"webHookID": "83d3731d2fc20204e1b9cefb411561cfdc5b57d3",
"type": "completedDocument",
"addedOn": 1709050181018,
"webHookUrl": "https://webhook.site/2424c940-1a2b-49bc-b2c8-b07ca0196c8c",
"options": []
},
"message": "WebHook Added Successfully",
"success": true,
"responseCode": 200
}
Listar los webhook
Puedes enlistar todos los webhook's que hallas registrado por tipo de evento, para ello puedes usar el siguiente endpoint
Petición
curl --location 'https://api-sandbox.weetrust.com.mx/webhooks' \
--header 'user-id: [USER_ID]' \
--header 'token: [ACCESS_TOKEN]'
Respuesta
{
"responseData": [
{
"webHookID": "83d3731d9fc24204e1b9c8fb011561cfdc5b57d3",
"type": "completedDocument",
"addedOn": 1709050181018,
"webHookUrl": "https://webhook.site/ca85fe6c-f53b-456-bf37-cdc85dce46eb",
"options": []
}
],
"message": "Get Successfully",
"success": true,
"responseCode": 200
}
Listar los webhook
Para eliminar un webhook, solo será necesario conocer el webHookID que se puede conseguir al momento de crear o de listar el webhook.
Petición
curl --location --request DELETE 'https://api-sandbox.weetrust.com.mx/webhooks?webHookID=83d3731d9fc20204e1b9cefb011561cfdc5b57d3' \
--header 'user-id: [USER_ID]' \
--header 'token: [ACCESS_TOKEN]' \
--header 'Content-Type: application/json'
Respuesta
{
"responseData": {},
"message": "Deleted Successfully",
"success": true,
"responseCode": 200
}
Respuesta a los eventos del webhook
Documento completado
{
"type": "completedDocument",
"Document": {
"_id": "65df4ceed7c349002a067f03",
"documentFileObj": {
"url": "[DOCUMENT_URL]",
"key": "[FILENAME].pdf",
"pendingForBlockChain": "",
"originalKey": "[FILENAME].pdf",
"version": "",
"size": "71.5 KB"
},
"createdBy": {
"userID": "[USER_ID]",
"adminID": "",
"fullName": "Firma digital",
"emailID": "[email protected]",
"isSigned": "false"
},
"savedDocument": {},
"computedFields": {
"signatoryCount": 1,
"pendingSignatoryCount": 0,
"biometricCount": 0,
"validBiometricCount": 0,
"pendingBiometricCount": 0,
"isAllSignatoryPending": false,
"signatoryCountLessOne": 0,
"isAllValidBiometric": true,
"search": [
]
},
"documentID": "65df4ceed7c499002a067f03",
"documentHash": "6f1de3e2f844b5346c960295761d7cbdb51e9f75adb5fee48ef9bbe35f456c7880839f2ca5176d68ef28c9e0ecad52328d1f126137c69334927054e08163",
"nomHash": "",
"apiNomFileName": "",
"pdfNomFileName": "",
"title": "[FILENAME].pdf",
"signatoryMessage": "Por favor firma el documento",
"signatoryTitle": "Fija firma por api",
"documentType": "OTHERS",
"verificationType": "",
"status": "COMPLETED",
"country": "Mexico",
"documentSignType": "ELECTRONIC_SIGNATURE",
"isForceID": false,
"hasOrder": false,
"disableMailing": false,
"documentFiles": [],
"signatory": [
{
"signing": {
"url": "[SIGNATURE_URL]",
"expiry": 1709997046234
},
"forceBiometric": {
"forcedPhotoID": false,
"forcedID": false,
"forcedFaceID": false,
"forcedBackgroundCheck": false,
"forcedFaceLogin": false,
"forcedOcr": false
},
"signatoryID": "65d45cf6d7c299002a067f0a",
"name": "Firma digital",
"emailID": "[email protected]",
"phone": "",
"verificationCode": "",
"password": "",
"order": 0,
"photo": [],
"isSigned": 1,
"signatureType": "",
"title": "Fija firma por api",
"message": "Por favor firma el documento",
"signature": [],
"signatureArray": [
{
"url": null,
"imageName": "[SIGN].png",
"svgCoordinates": null
}
],
"fieldArray": [
{
"left": 396,
"top": 475.99999999999994,
"pageY": 476,
"pageYv2": 475.99999999999994,
"width": 127.75735294117646,
"height": 68.13725490196079,
"type": "SIGNATURE",
"fontSize": 0,
"page": 1,
"viewport": {
"width": 695,
"height": 899
},
"extraData": {},
"value": "[SIGN].png"
}
],
"isInvalidSignature": false,
"invalidSignatureReason": "",
"biometricApprovedByUser": false,
"hasBiometricDocument": false,
"identitySessionId": "",
"biometric": null,
"_id": "65df4cf6d7c299002a067f0a",
"attachment": [],
"attachmentUrl": null
},
{
"userID": "[USER_ID]",
"adminID": "",
"fullName": "Firma digital",
"emailID": "[email protected]",
"isSigned": "false"
}
],
"processingStatus": "IMAGE_PROCESSING_COMPLETED",
"voBoStatus": "INITIAL",
"isVoBo": false,
"signatureArray": [],
"language": "es",
"addedOn": 1709133039470,
"modifiedOn": 1709133066759,
"isDeleted": 0,
"isInactive": 0,
"isCanceled": false,
"isActiveGeolocation": false,
"isBiometricIDEnabled": false,
"isBiometricFaceIDEnabled": false,
"isBiometricBackgroundCheckEnabled": false,
"version": 2,
"templateHistoryID": "",
"templateID": "",
"isTemplateV2": false,
"splitOriginDocumentId": "",
"splitChildDocumentId": "",
"splitPage": "",
"splitNumber": null,
"nickname": "",
"identityProvider": "[PROVIDER]",
"isSignatureText": false,
"source": "DOCUMENT",
"formSignatory": [],
"formStatus": "",
"formAnswer": null,
"hasLegalPrivacyPolicy": false,
"isEndorsement": false,
"endorsementsCount": 0,
"endorsementId": "",
"isHiddenCreated": false,
"autocaptureSDKEnabled": false,
"isRatification": false,
"documentImage": [],
"logsStatus": [
{
"operationData": {
"documentID": "",
"signatoryID": "",
"biometricID": "",
"endorsementID": ""
},
"operationBy": {
"name": "Firma digital",
"emailID": "[email protected]"
},
"operationType": "CREATED",
"sourceIP": "127.172.0.55",
"addedOn": 1709133039470,
"_id": "65df4cf6d7c299002a067f0b"
},
{
"operationData": {
"documentID": "",
"signatoryID": "",
"biometricID": "",
"endorsementID": ""
},
"operationBy": {
"name": "Test",
"emailID": "[email protected]"
},
"operationType": "SENT_FOR_SIGNATURE",
"sourceIP": "",
"addedOn": 1709133046234,
"_id": "65df4cf3d7c299002a067f0c"
},
{
"operationData": {
"documentID": "",
"signatoryID": "",
"biometricID": "",
"endorsementID": ""
},
"operationBy": {
"name": "Test",
"emailID": "[email protected]"
},
"operationType": "SIGNED",
"sourceIP": "127.172.0.34",
"addedOn": 1709133066759,
"_id": "65df4d0ad74299002a067f12"
},
{
"operationData": {
"documentID": "",
"signatoryID": "",
"biometricID": "",
"endorsementID": ""
},
"operationBy": {
"name": "",
"emailID": ""
},
"operationType": "STORED_IN_PSC_WORLD",
"sourceIP": "",
"addedOn": 1709133070090,
"_id": "65df4d0ed7c299002a067f19"
},
{
"operationData": {
"documentID": "",
"signatoryID": "",
"biometricID": "",
"endorsementID": ""
},
"operationBy": {
"name": "",
"emailID": ""
},
"operationType": "STORED_BLOCKCHAIN",
"sourceIP": "",
"addedOn": 1709133070090,
"_id": "65df4d0ed7c299002a067f1a"
}
],
"voBo": [],
"forwardings": [],
"__v": 0,
"computedAt": "2022-02-28T15:11:10.211Z",
"lastUpdatedAt": 1709133066759,
"documentURL": "[DOCUMENT_URL]",
"certificateURL": "[CERTIFICATE_URL]",
"pscCertificateURL": "[PSC_URL]"
},
"addedOn": 1709133077879
}
Firma de un documento
{
"type": "signDocument",
"Document": {
"_id": "65df50c0d7c299002a067f28",
"documentFileObj": {
"url": "[DOCUMENT_URL]",
"key": "[FILENAME].pdf",
"pendingForBlockChain": "",
"originalKey": "[FILENAME].pdf",
"version": "",
"size": "71.5 KB"
},
"createdBy": {
"userID": "[USER_ID]",
"adminID": "",
"fullName": "Firma digital",
"emailID": "[email protected]",
"isSigned": "false"
},
"savedDocument": {},
"computedFields": {
"signatoryCount": 1,
"pendingSignatoryCount": 1,
"biometricCount": 0,
"validBiometricCount": 0,
"pendingBiometricCount": 0,
"isAllSignatoryPending": true,
"signatoryCountLessOne": -1,
"isAllValidBiometric": false,
"search": [
]
},
"documentID": "65df50cc299002a067f28",
"documentHash": "",
"nomHash": "",
"apiNomFileName": "",
"pdfNomFileName": "",
"title": "[FILENAME].pdf",
"signatoryMessage": "Por favor firma el documento",
"signatoryTitle": "Fija firma por api",
"documentType": "OTHERS",
"verificationType": "",
"status": "PENDING",
"country": "Mexico",
"documentSignType": "ELECTRONIC_SIGNATURE",
"isForceID": false,
"hasOrder": false,
"disableMailing": false,
"documentFiles": [],
"signatory": [
{
"signing": {
"url": "[SIGNATURE_URL]",
"expiry": 1709998044386
},
"forceBiometric": {
"forcedPhotoID": false,
"forcedID": false,
"forcedFaceID": false,
"forcedBackgroundCheck": false,
"forcedFaceLogin": false,
"forcedOcr": false
},
"signatoryID": "65dfdcd7c299002a067f2f",
"name": "Test",
"emailID": "[email protected]",
"phone": "",
"verificationCode": "",
"password": "",
"order": 0,
"photo": [],
"isSigned": 1,
"signatureType": "",
"title": "Fija firma por api",
"message": "Por favor firma el documento",
"signature": [],
"signatureArray": [
{
"url": null,
"imageName": "[SIGN_DRAW].png",
"svgCoordinates": null
}
],
"fieldArray": [
{
"left": 396,
"top": 475.99999999999994,
"pageY": 476,
"pageYv2": 475.99999999999994,
"width": 127.75735294117646,
"height": 68.13725490196079,
"type": "SIGNATURE",
"fontSize": 0,
"page": 1,
"viewport": {
"width": 695,
"height": 899
},
"extraData": {},
"value": "[SIGN_DRAW].png"
}
],
"isInvalidSignature": false,
"invalidSignatureReason": "",
"biometricApprovedByUser": false,
"hasBiometricDocument": false,
"identitySessionId": "",
"biometric": null,
"_id": "65df50dcd799002a067f2f",
"attachment": [],
"attachmentUrl": null
}
],
"processingStatus": "IMAGE_PROCESSING_COMPLETED",
"voBoStatus": "INITIAL",
"isVoBo": false,
"signatureArray": [],
"language": "es",
"addedOn": 1709134018198,
"modifiedOn": 1709134526413,
"isDeleted": 0,
"isInactive": 0,
"isCanceled": false,
"isActiveGeolocation": false,
"isBiometricIDEnabled": false,
"isBiometricFaceIDEnabled": false,
"isBiometricBackgroundCheckEnabled": false,
"version": 2,
"templateHistoryID": "",
"templateID": "",
"isTemplateV2": false,
"splitOriginDocumentId": "",
"splitChildDocumentId": "",
"splitPage": "",
"splitNumber": null,
"nickname": "",
"identityProvider": "[PROVIDER]",
"isSignatureText": false,
"source": "DOCUMENT",
"formSignatory": [],
"formStatus": "",
"formAnswer": null,
"hasLegalPrivacyPolicy": false,
"isEndorsement": false,
"endorsementsCount": 0,
"endorsementId": "",
"isHiddenCreated": false,
"autocaptureSDKEnabled": false,
"isRatification": false,
"veridasSdkDocumentType": "",
"veridasSdkDefaultCountry": "",
"veridasSdkResidentPermit": false,
"documentImage": [],
"logsStatus": [
{
"operationData": {
"documentID": "",
"signatoryID": "",
"biometricID": "",
"endorsementID": ""
},
"operationBy": {
"name": "firma digital",
"emailID": "[email protected]"
},
"operationType": "CREATED",
"sourceIP": "[IP]",
"addedOn": 1709134018198,
"_id": "65df50dcd299002a067f30"
},
{
"operationData": {
"documentID": "",
"signatoryID": "",
"biometricID": "",
"endorsementID": ""
},
"operationBy": {
"name": "Test",
"emailID": "[email protected]"
},
"operationType": "SENT_FOR_SIGNATURE",
"sourceIP": "",
"addedOn": 1709134044386,
"_id": "65df50dcd7c299002a067f31"
},
{
"operationData": {
"documentID": "",
"signatoryID": "",
"biometricID": "",
"endorsementID": ""
},
"operationBy": {
"name": "Test",
"emailID": "[email protected]"
},
"operationType": "SIGNED",
"sourceIP": "[IP]",
"addedOn": 1709134526412,
"_id": "65df52bed799002a067f3a"
}
],
"voBo": [],
"forwardings": [],
"__v": 0,
"computedAt": "2022-02-28T15:27:24.580Z",
"lastUpdatedAt": 1709134044386,
"webhookData": {
"signatory": {
"signing": {
"url": "[SIGNATURE_URL]",
"expiry": 1709998044386
},
"forceBiometric": {
"forcedPhotoID": false,
"forcedID": false,
"forcedFaceID": false,
"forcedBackgroundCheck": false,
"forcedFaceLogin": false,
"forcedOcr": false
},
"signatoryID": "65df50dcd7c9002a067f2f",
"name": "Test",
"emailID": "[email protected]",
"phone": "",
"verificationCode": "",
"password": "",
"order": 0,
"photo": [],
"isSigned": 1,
"signatureType": "",
"title": "Fija firma por api",
"message": "Por favor firma el documento",
"signature": [],
"signatureArray": [
{
"url": null,
"imageName": "[SIGN_DRAW].png",
"svgCoordinates": null
}
],
"fieldArray": [
{
"left": 396,
"top": 475.99999999999994,
"pageY": 476,
"pageYv2": 475.99999999999994,
"width": 127.75735294117646,
"height": 68.13725490196079,
"type": "SIGNATURE",
"fontSize": 0,
"page": 1,
"viewport": {
"width": 695,
"height": 899
},
"extraData": {},
"value": "[SIGN_DRAW].png"
}
],
"isInvalidSignature": false,
"invalidSignatureReason": "",
"biometricApprovedByUser": false,
"hasBiometricDocument": false,
"identitySessionId": "",
"biometric": null,
"_id": "65df507c299002a067f2f",
"attachment": [],
"attachmentUrl": null
}
}
},
"addedOn": 1709134526652
}
Compartir documento
{
"type": "sendDocument",
"Document": {
"_id": "65df50c0d7c299002a067f28",
"documentFileObj": {
"url": "[DOCUMENT_URL]",
"key": "[FILENAME].pdf",
"pendingForBlockChain": "",
"originalKey": "[FILENAME].pdf",
"version": "",
"size": "71.5 KB"
},
"createdBy": {
"userID": "[USER_ID]",
"adminID": "",
"fullName": "FIRMA DIGITAL",
"emailID": "[email protected]",
"isSigned": "false"
},
"savedDocument": {},
"computedFields": {
"signatoryCount": 1,
"pendingSignatoryCount": 0,
"biometricCount": 0,
"validBiometricCount": 0,
"pendingBiometricCount": 0,
"isAllSignatoryPending": false,
"signatoryCountLessOne": 0,
"isAllValidBiometric": true,
"search": [
]
},
"documentID": "65df50c0d7c002a067f28",
"documentHash": "cfef0036be2dd04ca2c19908b694df570a9fda529d0bcf9e0fdc017e398efa68665f58bd89e99dc380bb36d97a1d4095d56469d81f0404bf746ee386b",
"nomHash": "688fb0d6790e2355e5b7b99127146e044bfc5b544189b4af27e1b73fb3e90f85da861a1f31d46e6b5086251f237f0f578311112ac1a8fba74c47fc9807cfa445",
"apiNomFileName": "[FILENAME].asn",
"pdfNomFileName": "",
"title": "[FILENAME].pdf",
"signatoryMessage": "Por favor firma el documento",
"signatoryTitle": "Fija firma por api",
"documentType": "OTHERS",
"verificationType": "",
"status": "COMPLETED",
"country": "Mexico",
"documentSignType": "ELECTRONIC_SIGNATURE",
"isForceID": false,
"hasOrder": false,
"disableMailing": false,
"documentFiles": [],
"signatory": [
{
"signing": {
"url": "[SIGNATURE_URL]",
"expiry": 1709998044386
},
"forceBiometric": {
"forcedPhotoID": false,
"forcedID": false,
"forcedFaceID": false,
"forcedBackgroundCheck": false,
"forcedFaceLogin": false,
"forcedOcr": false
},
"signatoryID": "65df5cd7c299002a067f2f",
"name": "Test",
"emailID": "[email protected]",
"phone": "",
"verificationCode": "",
"password": "",
"order": 0,
"photo": [],
"isSigned": 1,
"signatureType": "",
"title": "Fija firma por api",
"message": "Por favor firma el documento",
"signature": [],
"signatureArray": [
{
"url": null,
"imageName": "[SIGN_DRAW].png",
"svgCoordinates": null
}
],
"fieldArray": [
{
"left": 396,
"top": 475.99999999999994,
"pageY": 476,
"pageYv2": 475.99999999999994,
"width": 127.75735294117646,
"height": 68.13725490196079,
"type": "SIGNATURE",
"fontSize": 0,
"page": 1,
"viewport": {
"width": 695,
"height": 899
},
"extraData": {},
"value": "[SIGN_DRAW].png"
}
],
"isInvalidSignature": false,
"invalidSignatureReason": "",
"biometricApprovedByUser": false,
"hasBiometricDocument": false,
"identitySessionId": "",
"biometric": null,
"_id": "65df50d7c299002a067f2f",
"attachment": [],
"attachmentUrl": null
}
],
"processingStatus": "COMPLETED",
"voBoStatus": "INITIAL",
"isVoBo": false,
"signatureArray": [],
"language": "es",
"addedOn": 1709134018198,
"modifiedOn": 1709134526413,
"isDeleted": 0,
"isInactive": 0,
"isCanceled": false,
"isActiveGeolocation": false,
"isBiometricIDEnabled": false,
"isBiometricFaceIDEnabled": false,
"isBiometricBackgroundCheckEnabled": false,
"version": 2,
"templateHistoryID": "",
"templateID": "",
"isTemplateV2": false,
"splitOriginDocumentId": "",
"splitChildDocumentId": "",
"splitPage": "",
"splitNumber": null,
"nickname": "",
"identityProvider": "[PROVIDER]",
"isSignatureText": false,
"source": "DOCUMENT",
"formSignatory": [],
"formStatus": "",
"formAnswer": null,
"hasLegalPrivacyPolicy": false,
"isEndorsement": false,
"endorsementsCount": 0,
"endorsementId": "",
"isHiddenCreated": false,
"autocaptureSDKEnabled": false,
"isRatification": false,
"veridasSdkDocumentType": "",
"veridasSdkDefaultCountry": "",
"veridasSdkResidentPermit": false,
"documentImage": [],
"logsStatus": [
{
"operationData": {
"documentID": "",
"signatoryID": "",
"biometricID": "",
"endorsementID": ""
},
"operationBy": {
"name": "Firma digital",
"emailID": "[email protected]"
},
"operationType": "CREATED",
"sourceIP": "[IP]",
"addedOn": 1709134018198,
"_id": "65df50dcd7c299002a067f30"
},
{
"operationData": {
"documentID": "",
"signatoryID": "",
"biometricID": "",
"endorsementID": ""
},
"operationBy": {
"name": "Test",
"emailID": "[email protected]"
},
"operationType": "SENT_FOR_SIGNATURE",
"sourceIP": "",
"addedOn": 1709134044386,
"_id": "65df50dcd7c299002a067f31"
},
{
"operationData": {
"documentID": "",
"signatoryID": "",
"biometricID": "",
"endorsementID": ""
},
"operationBy": {
"name": "Test",
"emailID": "[email protected]"
},
"operationType": "SIGNED",
"sourceIP": "187.172.0.50:52429",
"addedOn": 1709134526412,
"_id": "65df52bed7c299002a067f3a"
},
{
"operationData": {
"documentID": "",
"signatoryID": "",
"biometricID": "",
"endorsementID": ""
},
"operationBy": {
"name": "",
"emailID": ""
},
"operationType": "STORED_IN_PSC_WORLD",
"sourceIP": "",
"addedOn": 1709134529687,
"_id": "65df52c1d7c299002a067f41"
},
{
"operationData": {
"documentID": "",
"signatoryID": "",
"biometricID": "",
"endorsementID": ""
},
"operationBy": {
"name": "",
"emailID": ""
},
"operationType": "STORED_BLOCKCHAIN",
"sourceIP": "",
"addedOn": 1709134529687,
"_id": "65df52c1d7c299002a067f42"
}
],
"voBo": [],
"forwardings": [],
"__v": 0,
"computedAt": "2024-02-28T15:35:34.512Z",
"lastUpdatedAt": 1709134526413,
"webhookData": {
"signatory": {
"emailID": "[email protected]"
},
"pscUrl": "[PSC_URL]",
"documentURL": "[DOCUMENT_URL]",
"certificateURL": "[CERTIFICATE_URL]"
}
},
"addedOn": 1709135576037
}