When an event for which you have registered a webhook happens, Sproom will send a request to the registered webhook url
All Requests will contain the following fields
Common webhook payload fields | |
---|---|
Field name | Description |
webhookType |
Type of webhook event, one of:
|
companyId | Id of the company that "owns" the document that this webhook event happened for |
In addition webhooks will have additional information, dependent on the webhook type:
documentReceived webhook payload fields | |
---|---|
Field name | Description |
documentType |
Type of document received, one of:
|
hasRelatedDocuments |
true/false - indicates whether this document has related documents. The value is true for Invoice and CreditNote that have a UTS reference, and for UtilityStatements with a reference to an Invoice or a CreditNote To see documents that are referring each other, use the GET api/documents/{documentId}/references endpoint. |
documentId | Id of the document that this webhook event happened for |
Example payload for documentReceived webhook call:
documentStatusChanged webhook payload fields | |
---|---|
Field name | Description |
documentStatus |
New status for the document, one of:
|
statusDetails | Detailed information about the new status. See below |
documentId | Id of the document that this webhook event happened for |
Example payload for documentStatusChanged webhook call:
peppolParticipantVerificationChanged webhook payload fields | |
---|---|
Field name | Description |
verificationStatus |
New status for Peppol Participant Verification, one of:
|
verificationId | The Guid of the verification |
Example payload for peppolParticipantVerificationChanged webhook call:
childCompanyEnrollmentChanged webhook payload fields | |
---|---|
Field name | Description |
childCompanyName | The name of the enrolled child company |
childCompanyIdentifier | The identifier of the enrolled child company. Contains:
|
childCompanyId | The unique identifier (Guid) of the enrolled child company |
status | The status of the company enrollment process. Can be one of:
|
reason | The reason for the enrollment rejection. It can be null. |
Example payload for childCompanyEnrollmentChanged webhook call:
Every webhook callback will be signed, and the signature will be in an X-Signature http header. It's important to verify signature for the webhook calls, to be sure that it is in fact Sproom that makes the call, and not a "man in the middle" or similar "attacker"
See the api/webhooks/key endpoint to get the public key needed for verification, and a simple example of how to verify the signature. A complete example for signature verification can also be found here: https://gist.github.com/gaevoy/ddf0478d17976cd4e492b0518dce69cd
The webhook call is expected to return a success HTTP status code (200 - 299) in a reasonable amount of time.
Webhook responses | |
---|---|
Response | Description |
HTTP status code in the success range, 200 - 299 | Webhook call was successful. Sproom will not call again |
HTTP status code outside of the success range | Webhook call not successful. Sproom will periodically retry the call |
Takes more than 100 seconds to respond | Webhook call timed out. Sproom will retry the call. |
If a webhook call doesn't succeed, Sproom will retry it periodically for 24 hours.
This means that webhook url's should never be down for longer periods of time. If you need to take your webhook service offline, you should delete or change the webhook registration in Sproom.