What is Webhook?
Webhook is used to send HTTP requests to a third party app or web service every time an event(when conditions are met) occurs in Freshsales.
This URL of the app or web service that’s hit by the API request is called a callback URL.
For eg: When a deal is won, you can send a request to generate an invoice from a third party app using a webhook request.
Who could possibly configure this?
Admin of a Freshsales account
Developers with REST API skills
You may configure HTTP URLs and associate them in workflow rules to automate the entire process.
Let’s see how to configure one such case.
Scenario: When a deal is won in Freshsales, an external invoice generator automatically generates an invoice via a webhooks request.
How to setup a Webhook request in Freshsales? (Learn more)
Workflow:
Log in as an Admin > Admin Settings > Workflows > New Workflow.
Add a
Name: Generate invoice when deal is won using Webhooks.
Description: For every deal won, automatically generate an invoice from Invoice
generator app using webhooks.
Choose the Record type: Deal.
Configure your Workflow’s,
Execution trigger: Once, when it’s created or updated
Conditions: Deal Property > Deal stage > is in > {Pipeline}:Won
Now choose an action from the drop-down.
Action: Trigger webhooks
6. In the overlay that comes up,
a: Choose the Request type as POST. (We are creating an object(invoice)).
The request types available in Freshsales are:
Each 3rd party app uses the request type in a different way, but most applications follow standard methods.
Request type | Fields |
GET or DELETE |
|
POST, PUT or PATCH |
|
b: Enter the invoice generator’s URL, say: https://invoice-generator.com/#/1
If you want to add the deal’s id as a placeholder please use the Advanced
content option.
c: If the third party application’s URL that is going to be hit requires authentication, then
check the Requires Authentication option. You can authenticate either with,
Username and password
Your account(third party app’s) API key
d: Add custom headers to pass along some additional information with the content such as security details, API version details and so on. A custom header has to be entered as a header-value pair in the following format: X-Sample-CustomHeader1: VALUE.
Note:
|
e: Let’s select JSON as the encoding format and choose the Simple content(Deal
details) that needs to be sent as a part of the webhook request.
And let us choose, Deal Value, Closed date, Created at, Product & Name(Sales
Account) as the fields to be sent as a part of the HTTP request.
Note:
|
f: Now Test the URL. Your,
request_sent section would have the following code
response_ received section would imply the status of the request, as in if it was received successfully by the app or was it a failure.
Note: To know more about decoding the error, check the below section on How do I test if my Webhooks request is working? |
g: Save the settings.
7. Either Save & Start the workflow immediately or just Save it for now and activate it later.
How do I test if my Webhooks request is working?
You can test a sample case using the Test URL option. The callback status code comes up as a toaster message.
If the callback status codes are between 200 and 299, the callback is a success.
Status codes other than 2xx indicate failure of the callback.
Note: When your callback fails,
|