Fonctionnalité #14055 » yousign.md
https://dev.yousign.com/#getting-started
USE CASE 1 (maarch courrier)
Action Envoyer au parapheur externe MP
Choix des personnes dans MP OU bouton ajouter un OTP
Nouvelle modale avec formulaire (choix d'un contact pour ses métadonnées)
Envoi a MP (step[0] user interne step[1] OTP)
{
"steps": [
{
"action": "visa",
"datePositions": [],
"externalId": 4,
"mainDocument": false,
"resId": 24,
"sequence": 0,
"signatureMode": "visa",
"signaturePositions": []
},
{
"action": "sign",
"datePositions": [],
"otp": {
"firstname": "John",
"lastname": "Doe",
"email": "john.doe@yousign.fr",
"phone": "+33612345678"
},
"mainDocument": false,
"resId": 24,
"sequence": 1,
"signatureMode": "otp",
"signaturePositions": []
}
]
}
nouveau mode otp
nouvelle table otps
id, user_id, firstname, lastname, email, phone, file_id, complement
Step 1 - Upload the files
The files on your server must be transferred to Yousign's infrastructure so that they can be processed.
Once you have received the response from our API, you should store on your side the ID of the file. It will be necessary to link the procedure we will create to this document.
In addition, it could be useful to download the signed document or to set up traceability on your side.
Finally, you will be able to link a file to only one procedure. If you want to create a new procedure with a file which is already linked with another procedure, you will receive an error from our API.
POST
[object Object]/files
AUTHORIZATION Bearer Token
[object Object]token {{your-api-key}}
HEADERS
[object Object]Authorization Bearer {{your-api-key}}
Content-Type application/json
BODY
[object Object]{
"name": "The best name for my file.pdf",
"content": "JVBERi0xLjUKJb/3ov4KNiA [...] VPRgo="
}
RESPONSE
[object Object]{
"id": "/files/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"name": "The best name for my file.pdf",
"type": "signable",
"contentType": "application/pdf",
"description": null,
"createdAt": "2018-12-01T11:36:20+01:00",
"updatedAt": "2018-12-01T11:36:20+01:00",
"sha256": "bb57ae2b2ca6ad0133a699350d1a6f6c8cdfde3cf872cf526585d306e4675cc2",
"metadata": [],
"workspace": "/workspaces/XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"creator": null,
"protected": false,
"position": 0,
"parent": null
}
Step 2 - Create the procedure
It's important to underline that email addresses need to have an existing domain. In addition, the phone numbers need to be valid numbers and follow the E.164 recommendation. Finally, please note that the page number of the documents starts at 1 and not 0.
POST
[object Object]/procedures
AUTHORIZATION Bearer Token
[object Object]token {{your-api-key}}
HEADERS
[object Object]Authorization Bearer {{your-api-key}}
Content-Type application/json
BODY
[object Object]{
"name": "My first procedure",
"description": "Awesome! Here is the description of my first procedure",
"members": [
{
"firstname": "John",
"lastname": "Doe",
"email": "john.doe@yousign.fr",
"phone": "+33612345678",
"fileObjects": [
{
"file": "/files/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"page": 2,
"position": "230,499,464,589",
"mention": "Read and approved",
"mention2": "Signed by John Doe"
}
]
}
]
}
RESPONSE
[object Object]{
"id": "/procedures/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"name": "My first procedure",
"description": "Awesome! Here is the description of my first procedure",
"createdAt": "2018-12-01T11:49:11+01:00",
"updatedAt": "2018-12-01T11:49:11+01:00",
"finishedAt": null,
"expiresAt": null,
"status": "active",
"creator": null,
"creatorFirstName": null,
"creatorLastName": null,
"workspace": "/workspaces/XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"template": false,
"ordered": false,
"parent": null,
"metadata": [],
"config": [],
"members": [
{
"id": "/members/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"user": null,
"type": "signer",
"firstname": "John",
"lastname": "Doe",
"email": "john.doe@yousign.fr",
"phone": "+33612345678",
"position": 1,
"createdAt": "2018-12-01T11:49:11+01:00",
"updatedAt": "2018-12-01T11:49:11+01:00",
"finishedAt": null,
"status": "pending",
"fileObjects": [
{
"id": "/file_objects/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"file": {
"id": "/files/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"name": "The best name for my file.pdf",
"type": "signable",
"contentType": "application/pdf",
"description": null,
"createdAt": "2018-12-01T11:36:20+01:00",
"updatedAt": "2018-12-01T11:49:11+01:00",
"sha256": "bb57ae2b2ca6ad0133a699350d1a6f6c8cdfde3cf872cf526585d306e4675cc2",
"metadata": [],
"workspace": "/workspaces/XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"creator": null,
"protected": false,
"position": 0,
"parent": null
},
"page": 2,
"position": "230,499,464,589",
"fieldName": null,
"mention": "Read and approved",
"mention2": "Signed by John Doe",
"createdAt": "2018-12-01T11:49:11+01:00",
"updatedAt": "2018-12-01T11:49:11+01:00",
"parent": null,
"reason": "Signed by Yousign"
}
],
"comment": null,
"notificationsEmail": [],
"operationLevel": "custom",
"operationCustomModes": [
"sms"
],
"operationModeSmsConfig": null,
"parent": null
}
],
"subscribers": [],
"files": [
{
"id": "/files/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"name": "The best name for my file.pdf",
"type": "signable",
"contentType": "application/pdf",
"description": null,
"createdAt": "2018-12-01T11:36:20+01:00",
"updatedAt": "2018-12-01T11:49:11+01:00",
"sha256": "bb57ae2b2ca6ad0133a699350d1a6f6c8cdfde3cf872cf526585d306e4675cc2",
"metadata": [],
"workspace": "/workspaces/XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"creator": null,
"protected": false,
"position": 0,
"parent": null
}
],
"relatedFilesEnable": false,
"archive": false,
"archiveMetadata": [],
"fields": [],
"permissions": []
}
Step 3 - Attach other files
This means that attachment files must be added after the creation of the procedure. You will not be able to add attachments until you have created the signing procedure.
POST
[object Object]/files
AUTHORIZATION Bearer Token
[object Object]token {{your-api-key}}
HEADERS
[object Object]Authorization Bearer {{your-api-key}}
Content-Type application/json
BODY
[object Object]{
"name": "Name of my attachment.pdf",
"content": "JVBERi0xLjUKJb/3ov4KICA[...]VPRgo=",
"procedure": "/procedures/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"type": "attachment"
}
PROBLÉMATIQUES
Comment paramétrer l'utilisateur OTP ?
nouveau bouton => Interface modal lors de la création du circuit ?
Ou stocker la clé API du compte YOUSIGN ?
Interface d'administration ?
Fichier de configuration serveur ?
Cohabiter les utilisateurs internes et les OTP ?
Un id user est lié à une ligne dans la table workflow
mettre id 0 plus mode => otp_yousign
nouvelle table otp
Quand lancer la procédure dans yousign ?
Si le circuit comporte des utilisateurs internes et OTP, il faudra lancer la procédure au moment de la validation du précédent user interne.
Comment savoir si l'OTP à fait une opération ?
Voir les webhook : https://dev.yousign.com/#127f4e4a-10f6-4310-9fcf-cb7c6fe2088a => maj de la table workflow
OTP avec synchro via MAARCH COURRIER ?
???
N.B :
Les pages dans YOUSIGN commencent à 1 pas 0
Voir le référentiel pour la position de signature
position Defines the coordinates of the signature image. You can go to How to calculate the coordinates of signature image? if you want to understand how to calculate the position. If you want to define the position manually, you can use our free tool on: https://placeit.yousign.fr.
Format :
llx = X-axis (definition of horizontal size). This is the space from the left side of the page to the left side of the visual signature ("left lower x").
lly = Y-axis (height definition). This is the space from the bottom of the page to the bottom of the visual signature ("left lower y").
urx = X-axis (definition of horizontal size). This is the space from the left side of the page to the right side of the visual signature ("upper right x").
ury = Y-axis (height definition). This is the space from the bottom of the page to the top of the visual signature ("upper right y").
Algo : pour maarch => llx == posX (en px) et ury == poxY (en px) ici blocHeight == 39 et blocWidth == 99
llx = (posX * docWidth) / 100
lly = docHeight - (((posY * docHeight) / 100) + blocHeight)
urx = blocWidth + ((posY * docWidth) / 100)
ury = docHeight - ((posY * docHeight) / 100)
Pre-voir de génériser le code pour de futures connecteurs