Getting the error: "Invalid or non-reachable URL" for Webhook endpoint

Hi,

I’m trying to create a webhook for my .net application hosted on azure’s deployment slot and so the endpoint url is like: https://xxx-qa.azurewebsites.net/webhooks/dealupdated

When i’m saving the webhook in pipedrive with that url, save fails with the error: Invalid or non-reachable URL. Although the url is publicly accessible and its a HttpPost method taking a single string parameter for the request.

Any pointers on what am I missing here would be appreciated.

Updated server post method parameter with class WebhookResponse<WebhookDeal> that corresponds to the fields of JSON sent as response from webhook. Still the same error!

What is the object being sent to the endpoint initially to validate it?

@DavidRouyer I’m using pipedrive-dotnet for the integration. Any documentation/sample on how to use the webhooks would be greatly appreciated. I’m currently using like below and it isn’t working.

IConnection connection = new Connection(new ProductHeaderValue("PipedriveExample"), new Uri("https://oauth.pipedrive.com"));
client = new WebhooksClient(new ApiConnection(connection));

And then, endpoint for updating deal is as follows:

    [Route("Webhooks/DealUpdate")]
    [HttpPost]
    [IgnoreAntiforgeryToken]
    public IActionResult DealUpdate(string response)
    {
        try
        {
            var request = client.ParseWebhookDealResponse(response);
            if (request != null)
            {
                _pipedriveService.UpdateDeal(request);
            }
            return Ok(request);
        }
        catch (Exception e)
        {
            return Json(new { message = e.Message });
        }
    }

Would highly appreciate if you could help me out on this.

Hi,

Are you sure you got the right URL of your Azure Functions? It seems not as Pipedrive can’t talk to your endpoint.
Take the right URL from the portal, and test if you’re actually hitting the Azure Functions endpoint with Pipedrive. Try with a dummy function that only returns a successful response (200 HTTP Code).

You are providing the wrong URL when creating the Pipedrive client: https://oauth.pipedrive.com. It should be something like https://mycompany.pipedrive.com. Check your Pipedrive settings for your Pipedrive domain.

Here is how I use it in my Azure Functions:

[FunctionName("WebhookDealUpdate")]
public async Task<IActionResult> Run([HttpTrigger(AuthorizationLevel.Function, "post", Route = null)]HttpRequest req, ILogger log)
{
	log.LogInformation("[WebhookDealUpdate] HTTP trigger function processed a request.");

	string requestBody = await new StreamReader(req.Body).ReadToEndAsync();

	log.LogInformation(requestBody);

	var pipedriveApiUrl = "https://mycompany.hopfab.com";
	var pipedriveApiToken = "token";

	IPipedriveClient client = new PipedriveClient(new ProductHeaderValue("MyCompany.Pipedrive"), new Uri(pipedriveApiUrl))
	{
		Credentials = new Credentials(pipedriveApiToken, AuthenticationType.ApiToken)
	};

	IWebhookResponse<WebhookDeal> data = null;
	try
	{
		data = client.Webhook.ParseWebhookDealResponse(requestBody);
	}
	catch (Exception e)
	{
		throw new Exception("Unable to deserialize the deal", e);
	}
}

@DavidRouyer Thank you so much for this! Much appreciated.

I created a dummy azure function and I’m able to access it using Postman & Powershell, but Pipedrive still throws invalid or non-reachable URL. (Please note that currently, the authorization level of the azure function is set to anonymous. And I’ve tried with authorization level of function and access it with the key appended, still the same error.)

Here’s the dummy azure function:

I don’t know what’s wrong with your setup.

I have deployed multiple Azure Functions and the URL looks like:
https://myAzureFunctionsDomain.azurewebsites.net/api/NameOfMyFunction
And in your first post it was something like:
https://xxx-qa.azurewebsites.net/webhooks/dealupdated

Make sure you setted the right URL in Pipedrive.
I can’t help you further without any additional detail, sorry :confused:

1 Like

In my first post, it was pointing to the API controller (named “webhooks”) of our application.
But after your suggestion to try with a dummy azure function, the URL was similar to yours.
But receiving the same error on saving the webhook in Pipedrive.

No problem, I’m waiting to hear from pipedrive on this. Thanks again for all your help! :slight_smile:

@sumiyafaruq is your endpoint set to accept POST requests? :thinking:

Yes, it is set to accept POST requests.

As you can see in the image below, I’m able to make a POST request and getting 200 response in Postman (Header Content-type is set to: application/json):