Webhook to create a SF task failing | Community
Skip to main content
Shashank_Sharma
New Participant
September 19, 2016
Solved

Webhook to create a SF task failing

  • September 19, 2016
  • 1 reply
  • 4426 views

Hi,

I'm trying to setup a webhook to create task in SF. I'm getting the 401 error. Error Message - "HTTP Error 401: Unauthorized access to URL".

I'm using the same SF user that is setup in the main Marketo-SF sync. Not sure what am I doing wrong here. Has anyone faced the same challenge and how did you fix it?

Thanks,

Shashank Sharma

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SanfordWhiteman

Thanks for sharing the thoughts! Actually, I have another webhook for adding leads to SF campaign as a member, this works fine. Screenshot below:

I'm using the same approach to setup the task webhook and getting the 401 error. Not sure what I need to do differently to fix this!


Then someone turned off the authentication requirement on the other endpoint. You should also look to see if there are any custom headers set up in the other webhook definition (Webhooks Actions >> Set Custom Header).

The HTTP 401 isn't being generated before Marketo makes the webhook call, it's the response to the webhook call.

I hope you aren't running a public endpoint that allows anyone to hit your Salesforce instance without auth.

1 reply

SanfordWhiteman
New Participant
September 19, 2016

Since you haven't provided your code (at least not that I can see in mobile view) it won't be possible to troubleshoot this.

Shashank_Sharma
New Participant
September 20, 2016

Hi Sanford,

Here's the error screen containing the payload and the error details. Any insights on how to fix this would be really helpful!

Thanks,

Shashank Sharma

SanfordWhiteman
New Participant
September 20, 2016

Well, "Session expired" is pretty clear here: this is not a public endpoint, and Salesforce expects you to transport an authentication token.  Otherwise, anybody could add tasks to any record in your db (you could deliberately create such a public endpoint, but it's not going to exist out-of-the-box).

I get the feeling you haven't thought through the OAuth token process. This is the reason OAuth + REST endpoints don't typically work with direct webhook calls (they require an intermediate hop to manage tokens).