LeadSquared Developer Centre

ON THIS PAGE

Webhook Best Practices


This article tells you the best practices and recommendations for implementing webhooks. To find out more about setting up webhooks, visit LeadSquared Webhooks.

  1. Your webhook URL should support the HTTP HEAD method:
    HEAD requests are used for ‘handshakes’. They are similar to GET requests, but without the response body. This provides an easy way to retrieve meta-information from the header response without transporting the entire content. It’s a fast way to check headers and server info for a given resource so we recommend you to support it.
  2. Your webhook should always have a response:
    Whether or not the request was successful, your webhooks should always have a response. The recommended format for the response is JSON. You can have simply responses like:

    {"Status":"Success", "StatusReason":""}  or
    {"Status":"Error", "StatusReason":"Invalid input....."}
  3. Your webhook code should always respond with 200 OK (Success):
    Your webhook code should return 200 OK to LeadSquared. Even if errors were encountered, 4xx or 5xx statuses should not be returned. Instead, you should return 200 OK with the with the details of the error in the ‘StatusReason’ node shown in the example above. This will ensure that the webhooks are not disabled and LeadSquared support can see the error messages in the webhook history.
  4. Your webhook code should have detailed logs:
    We recommend that you write details logs so you can better monitor events and diagnose errors.

Please write to us at support@leadsquared.com if you need any assistance.

On this page

© 2024 by MarketXpander Services Pvt Ltd. All Rights Reserved.