About Webhooks

🚀

What are they?

Webhooks are events we send to your pre-set endpoints via HTTP POST requests. They serve as a means of notification for when verification(s) has been completed.

Which Verifications require webhooks?

At the moment the following verifications require webhooks to be set:

  • Address Verification

  • Guarantor Verification

How do I add my webhook?

Webhooks can be added from your VerifyMe account dashboard

Webhook Signature

Webhook signatures are a means for you to verify if a webhook originated from our servers. All webhooks events have the x-verifyme-signature HTTP header which is a hash of the body of the request and your secret key.

Sample Code

NodeJs
Go
NodeJs
const crypto = require('crypto')
// your api secretkey ( testSecretKey or liveSecretKey)
const secretKey= process.env.SECRET_KEY
const WebhookHandler = (req , res ) =>{
const signature = crypto.createHmac('sha512', secretKey).update(JSON.stringify(res.body)).digest('hex');
if(signature === req.headers['x-verifyme-signatue']){
// Source of the webhook is verified , Add logic here
}
}
Go
import (
"crypto/hmac"
"crypto/sha512"
"encoding/hex"
"io/ioutil"
"net/http"
"os"
)
// your api secretkey ( testSecretKey or liveSecretKey)
var secret = os.Getenv("SECRET_KEY")
func WebhookHandler(w http.ResponseWriter, r *http.Request) {
hash := hmac.New(sha512.New, []byte(secret))
requestBody, _ := ioutil.ReadAll(r.Body)
hash.Write(requestBody)
sha := hex.EncodeToString(hash.Sum(nil))
if sha == r.Header.Get("x-verifyme-signature") {
// Source of the webhook is verified , Add logic here
}
}