Skip to main content
Hi Friends, I am new to integration and my task is

How to create webhooks in salesforce ?

thanks in advance.
7 respostas
  1. 9 de dez. de 2025, 19:27

    First create apex class as the following example:

    @RestResource(urlMapping='/myWebhookEndpoint/*')

    global class MyWebhookHandler {

    @HttpPost

    global static void handlePostRequest() {

    // Process the incoming request body

    String requestBody = RestContext.request.requestBody.toString();

    System.debug('Received webhook payload: ' + requestBody);

    // Perform actions based on the payload (e.g., create/update records)

    // ...

    }

    }

     

    Then follow this steps to make your endpoint public and how to test it: 

    1. Go to Setup -> Sites and open the Site that you created for this. 

    2. Click on the button named "Public Access Settings" 

    3. Add your Apex Class inside "Enabled Apex Class Access" 

    4. Go back to your Site, and check your "Domain Name" and the "Path" which will help you construct your public URL.  

    4.1 The url will in this format: [DomainName]/[Path]/services/apexrest/[urlMapping] 

    4.2 It will look something like this (I'm using developer org): 

    https://xxx.develop.my.site.com/demoSitePath/services/apexrest/webhookUrlMapping

     5. Do POST callout to the url above

0/9000