It’s easy to keep your application in sync with a SalenGo account if you can publish scripts to a public web server.
You can subscribe to our Webhooks to receive real-time notifications from SalenGo to your application.
What are Webhooks?
Webhooks are a "pattern of enabling user-defined callbacks in web applications" (1). In other words, they are a simple mechanism for sending notifications between APIs using HTTP POST callbacks. Webhooks allow you to specify a URI that you would like SalenGo to POST information to any time certain events happen in a system. For instance, if you would like to receive a notification every time one of your users creates an invoice in SalenGo, you can register a callback for the
Webhooks can be created in your SalenGo account by clicking on "My Account" >> "API” and then scrolling down to the "Customize" link in the Webhooks section, or with the API by calling the
In order to ensure that you are the true owner of a callback URI being registered, we’ve implemented a very simple verification mechanism. When a callback is first registered, we will automatically (and immediately) send an HTTP POST request containing a unique verification code as well as a unique id for the callback record being verified. Simply send the verification code and the callback id back to us by calling the
The transaction looks something like this:
Step One: Create a callback using the
SalenGo will immediately POST to the URI specified in the
Step Two: Verify the callback using the callback.verify API method:
That’s it! Your callback is ready to go. Now, when a user in this system creates an estimate, SalenGo will send a POST request to http://example.com/webhooks/ready with the following form-urlencoded parameters: name:
This means that the user with the id '1' in the company name '2ndsite’ created an estimate with the id ’30′. You can then call the API method
You can also list and delete callbacks using the
NOTE: If you create a callback record before your script is ready to receive the verification code, you can resend the verification code with a call to
Once your Webhooks are set up and verified, you will start receiving events. If SalenGo receives anything other than a 2xx HTTP response code (likely meaning that your web script has moved, is non-existent, or misconfigured), we will retry the HTTP POST request periodically. After several failures, the message will be dropped and no further delivery attempts will be made.
The following is an example of the HTTP requests and responses involved in creating a Webhook.
1. Creating the callback using the API.Request
2. Verification information is sent to the callback URI.Request
3. Verifying the callback using the xxx API.Request
4. Your first Webhook.Request
Entirely up to you! Just send us back an HTTP 2xx response code if everything worked out alright.