Skip to main content

Webhook

Enrollment​

During enrollment phase, client can specify an url where they want to receive webhook data. For change this url or to insert it at a later time after registration write at [email protected]

Webhook Requests​

Webhook POST requests will contain a single payload object inside body. payload is signed through a jwt that must be verified in order to be able to read data.

After the enrollment, each client will receive a public key required to decrypt the payload. The algorithm used is RS256

JWT Verification example​

const readWeStudentsWebhook = async (req, res) => {
try {
const { payload } = req.body

// token decode
const decodedData = await jwt.verify(payload, 'webhook_public_key', { algorithms: ['RS256'] })

if (decodedData.eventType === 'STUDENT_VERIFICATION') {
// do something
}
} catch (e) {
console.log("Error in jwt verification")
}
}

Webhook Events​

STUDENT VERIFICATION​

This event will be fired each time an async process of student verifcation (verification through doucument and verification through email) is completed. Data inside payload once decrypted are:

  • eventType: string: STUDENT_VERIFICATION
  • userId: string: id of the user associated to the student verification request
  • verificationMethod: string: method associated to the student verification request, it can be "EMAIL" or "DOCUMENTS"

Body Example Encrypted

{
"payload": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJ0ZXN0X3VzZXJfaWQiLCJldmVudFR5cGUiOiJTVFVERU5UX1ZFUklGSUNBVElPTiIsInZlcmlmaWNhdGlvbk1ldGhvZCI6IkVNQUlMIiwiaWF0IjoxNjU0ODUwMTg5fQ.Q6hCBqNEiyI2bCi2sShDC2kNZiO1wqw3kCsqEfrUjKUJ_mRZwDvsohUdA9zhmbt6CJHQt6h6GNxnLDc_cIByew"
}

Payload Example Decrypted

{
"eventType": "STUDENT_VERIFICATION",
"verificationMethod": "EMAIL",
"userId": "test_user_id"
}