function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Test Dev 81Test Dev 81 

Webhook Intent to receive required

Hi Guys,
I am Integrating Xero with salesforce in my dev org
here's the validation code for the webhook
@RestResource(urlMapping='/XeroApi/*')
Global class RT_XeroApiClass {
    global static String jsonResults;
    @HttpPost
    global static Integer validatexero () {
        String xeroSignature = RestContext.request.headers.get('x-xero-signature');
        String xeroPayload = RestContext.request.requestBody.toString();
        Blob signedPayload = Crypto.generateMac('hmacSHA256', Blob.valueOf(xeroPayload), Blob.valueOf(System.Label.Webhook_Payload));
        String encodedPayload = EncodingUtil.base64Encode(signedPayload);
        RestContext.response.statusCode = encodedPayload == xeroSignature ? 200 : 401;
        
        return RestContext.response.statusCode;
    }
}
The Delivery URL in the webhook is
https://appl-dev-ed.my.salesforce.com/services/apexrest/XeroApi
when I am sending Intent to receive the status always shows "Intent to receive" required
User-added image
can you please tell me what I am missing here?
Thanks,
Rahul
Tyler Tran 94Tyler Tran 94
Maybe the problem is in 
Blob signedPayload = Crypto.generateMac('hmacSHA256', Blob.valueOf(xeroPayload), Blob.valueOf(System.Label.Webhook_Payload));
You should change the System.Label.Webhook_Payload to the Webhook Key in Xero.