Webhooks
Integrate to Vendre and find out when e.g. orders & customers are added or changed
Integrate to Vendre and find out when e.g. orders & customers are added or changed
Vendre's Webhooks system allows you to know in real time when an event has occurred in Vendre. This can be, for example, if an order has been received.
The webhook sends basic information about the event in question.
| Event | Triggered when | Data sent with |
|---|---|---|
| new_customer | Customer is created | API according to GET on customer |
| updated_customer | Customer updated | API according to GET on customer |
| new_order | New order | API according to GET on order |
| updated_order | Updated order | API according to GET on order |
| deleted_customer | Customer removed | API according to GET on customer |
| Shopping basket modified | Logged in customer adds, removes or changes product in the shopping cart. |
See below. |
| Fields | Data |
|---|---|
| customer | API according to GET on customer |
| customer_extra.group_name | Name of the customer's customer group/price list. |
| customer_extra.language_code | Language code for the customer's chosen language. |
| products[].id_string | Product ID number and attributes and other. |
| products[].id | The product identification number. |
| products[].image_id | Product main image ID. |
| products[].image_path | Path to the image, domain names are not included. |
| products[].quantity | Number of the product in this product row in the shopping cart. |
| products[].model | Article number of the product. |
| products[].name | Name of the product. |
| products[].price | The price of the product before certain discounts and attribute values. |
| products[].final_price | The price of the product. |
| products[].tax | VAT percentage of the product. |
| products[].tax_class_id | VAT class identifier of the product. |
| products[].weight | Weight of the product in kg. |
| products[].package_content | Number of units per piece in the unit function. |
| products[].unit | Abbreviation of the product unit in the unit function. |
You can activate and work with webhooks directly in Vendre's administration. Go to Apps & Integration > Webhooks to find them.
You can:
If you delete a webhook link, or a webhook type, all logs belonging to that link/type are also deleted.
A webhook is sent to the URL you enter in admin shortly after the event has been triggered in Vendre. The webhook is sent once and is not resent in case of error.
The call is always sent as a GET request when we send calls without data, otherwise it is always sent with a POST request with JSON data associated with the event.
We send an extra header with our webhook calls.
This header is called "vendre-webhook-event" which contains the name of the event linked to the webhook, e.g. "customer created".
By switching on Send with data, you can choose whether or not the webhook you set up should send relevant data.
Data is always sent in JSON format in a POST request and follows the same data structure and information as our API, with the exception that we send a parameter called"webhook_event", which contains the name of the event, e.g."webhook_event":"customer created".
For example, if you set a webhook against the 'updated_customer' event, we will send the same information as you get in response to calls against our customer API (e.g. api/customers/13).
For some webhooks you have the option to send extended data. This is generally data that is not always necessary and increases both the load on the server and the amount of data sent back. Usually this is not a problem as long as it does not involve abnormally large amounts of calls or abnormally large amounts of data, but they should never be activated casually.
When a webhook supports extended data, there are one or more options in the"Extended data" column that can be activated. Each option adds a field with extended data as specified. The name of the option indicates both the name of the field and also any path. For example, if you activate"products/tags" for the order webhook, the extended data field"tags" is added for each order line in the"products" list.
The data added in each place follows the system standard for each object in the API. See below for the most common extended data fields for the order webhook.
[
{
"customer_groups": [
{
"id": 0,
"status": true
}
],
"description": {
"sv": "string",
"en": "string"
},
"external_id": 0,
"extra": {
"1": "string",
"2": "string",
"3": "string",
"4": {
"sv": "string",
"en": "string"
},
"5": {
"sv": "string",
"en": "string"
}
},
"filters": [
{
"id": 0,
"type": 0,
"names": {
"sv": "string",
"en": "string"
}
}
],
"google_product_category": 0,
"icon_image_id": 0,
"icon_image_url": "string",
"id": 0,
"image_id": 0,
"image_url": "string",
"meta_description": {
"sv": "string",
"en": "string"
},
"meta_keywords": {
"sv": "string",
"en": "string"
},
"meta_title": {
"sv": "string",
"en": "string"
},
"name": {
"sv": "string",
"en": "string"
},
"parent_external_id": "string",
"parent_id": 0,
"seo_link": {
"sv": "string",
"en": "string"
},
"seo_text": {
"sv": "string",
"en": "string"
},
"seo_title": {
"sv": "string",
"en": "string"
},
"show_in_listing": true,
"show_sub_categories": true,
"sort_order": 0,
"status": true
}
]
{
"generic": [
{
"id": 0,
"value": "string"
}
],
"value": [
{
"id": 0,
"value": "string"
}
],
"text": [
{
"id": 0,
"value": {
"sv": "string",
"en": "string"
},
"short_value": {
"sv": "string",
"en": "string"
}
}
]
}
[
{
"description": {
"sv": "string",
"en": "string"
},
"external_id": 0,
"image_id": 0,
"image_url": "string",
"meta_description": {
"sv": "string",
"en": "string"
},
"meta_keywords": {
"sv": "string",
"en": "string"
},
"meta_title": {
"sv": "string",
"en": "string"
},
"name": {
"sv": "string",
"en": "string"
},
"parent_id": 0,
"seo_text": {
"sv": "string",
"en": "string"
},
"seo_title": {
"sv": "string",
"en": "string"
},
"sort_order": 0,
"status": true
}
]
We recommend not relying solely on webhooks to stay in sync with Vendre. Also sync up to our API regularly.
It is important to keep in mind that if your ERP system imports customers and you import many customers at the same time with updated information, this can create a loop that triggers many webhooks at the same time. You need to take this into account in your integration and that you can receive many calls on updated and new customers.