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
ran67ran67 

Webhook Integrations salesforce

Hi,

I have activate my site url in the campagain mointor and now am  able to run my class and page when a  record is edit in the webhook . as per document they  told when the url is executed the json data  will  added . bt when am making the http request Post to the site url am   getting the error has 401 of the error has unauthorized error.

Can you please how to  call the post Request  in the salesforce and read the json data .

sunny522sunny522
Hi ran67,

create a rest resource class  and add this class to site and give this public class url to webhook.webhook will post data to this class.You can access the data as shown below.using json parser methods you can parse json data.

@RestResource(urlMapping='/webhookRespose/*')
global class FirstAdvantageRestController {

    public static string restResponse='';
  
    @HttpPost
    global static string FAResponse()
    {
        RestRequest req = RestContext.request;
        String ipAddress = req.remoteAddress;
        Blob body = req.requestBody;
        system.debug('...................'+req);
        String bodyString = body.toString();
        system.debug('...................'+bodyString );
  }
}

let me know if it helped
ran67ran67
Can you please check whethere any issue with service or its normally you can you execute or not