Hi, I am trying to send events to Webhook (Salesfo...
# support
r
Hi, I am trying to send events to Webhook (Salesforce Rest API). Is there any way to authenticate the salesforce using transformation or any other way to securely send events to Salesforce Rest API (custom API)? Any help will be appreciated.
m
Hey There! šŸ‘‹ Your message has been received by the RudderStack team. Our standard customer support hours are 9-6 PM EST, but we will forward this request to your Technical Account Manager, and they will get back to you shortly. Please use the thread for any additional comments.
r
Any update on this will be helpful @helpful-daybreak-79835
q
Yes, you can authenticate a Webhook destination to securely send events by adding custom headers to your events. RudderStack allows you to add custom headers for your events via the Webhook destination’s connection settings. These headers will be added to the request made from RudderStack to your webhook, ensuring secure event delivery. Here’s a summary of the steps to add custom headers to your Webhook destination: 1. In the Connection Settings page of your Webhook destination, enter the relevant connection information. 2. Add custom headers for your events using the Headers option. By default, RudderStack adds the following headers for the
POST
and
PUT
requests: | Key | Value | | --- | --- | |
User-Agent
|
RudderLabs
| |
Content-Type
|
application/json
| RudderStack also supports adding a dynamic header to your events through user transformation. You can do it like this
Copy code
#Dynamic header
#Add a dynamic header to event payload

export function transformEvent(event, metadata) {
    event.header = {
        dynamic_header_1: "dynamic_header_1_value",
        dynamic_header_2: "dynamic_header_2_value"
    };
    return event;
}
r
Yes I tried this approach but Salesforce doesn’t support basic authentication and I am stuck at that point. Please help me out here as it’s a critical challenge for us.
Salesforce supports oAuth and it required api callout to generate access token and I am not able to do that due to CORS restrictions.
@quiet-wolf-72320
In rudderstack, when we select salesforce as destination, we get the option to enter username, password and security token. Using those details access token is generated in backend using transformations created by your team for salesforce. I want to achieve the same for Webhook destinations. But due to CORS policy I am not able to generate access token in tranformation. cc: @plain-parrot-49913
@quiet-wolf-72320
q
Which edition of salesforce you are using, take a look at this FAQ https://www.rudderstack.com/docs/destinations/streaming-destinations/salesforce/#faq
r
@quiet-wolf-72320 I am not using Salesforce as a destination. I am using webhook as a destination as mentioned earlier. The webhook is in salesforce and I am not able to authentication with oAuth flow.
@quiet-wolf-72320 Can you please check this as this is a road-blocker for us?
m
Salesforce provides CORS settings known as "CORS Whitelisting" and can be configured to specify which domains are allowed to make cross-origin requests to Salesforce resources. It can be done here _*Setup > Security > CORS > New*⁣_⁣ _*Have you tried this?*⁣_⁣
r
No, I didn't tried this. I will check this. Thanks