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
Ryan Raymundo 1Ryan Raymundo 1 

handle webbooks from other site in salesforce

I have created an apex class @RestResource and with @HttpPost, now how can it handle webhook w/o authentication?
Best Answer chosen by Ryan Raymundo 1
HarshHarsh (Salesforce Developers) 
Hi Ryan,
You can refer to the below link on Salesforce Webhook Integration.
https://hevodata.com/learn/salesforce-webhook-integration/ 

Please follow the Salesforce help article
https://help.salesforce.com/s/articleView?id=sf.c360_a_create_a_data_action_target_of_webhook_type.htm&type=5

Please mark it as Best Answer if the above information was helpful.

Thanks.
 

All Answers

HarshHarsh (Salesforce Developers) 
Hi Ryan,
You can refer to the below link on Salesforce Webhook Integration.
https://hevodata.com/learn/salesforce-webhook-integration/ 

Please follow the Salesforce help article
https://help.salesforce.com/s/articleView?id=sf.c360_a_create_a_data_action_target_of_webhook_type.htm&type=5

Please mark it as Best Answer if the above information was helpful.

Thanks.
 
This was selected as the best answer
Ryan Raymundo 1Ryan Raymundo 1
Hello Harsh, Thank you for your response, sorry for my post which is not clear. What I need is to handle API calls from other systems, and handle it in Salesforce. I was able to make the apex class public and accept calls which works now but I wanted to just add some simple authentication. I wanted to get the auth header and compare it to my metadata types data before I process the JSON body. 

My issue is I cant get the authorization basic using this code: 
RestRequest req = RestContext.request;
        if (req.headers.get('Authorization') == null)
        {
            // always goes here
            authorizationHeaderValue = 'Null';
        }


but using https://webhook.site/, header auth is being passed and working as expected. 
 
HarshHarsh (Salesforce Developers) 
Hi Ryan,
Welcome :) Please consider marking the answer best so it can help others too. Thank you