Menar du...


  • Kategorier för din sökning

  • Inget resultat

     Webhooks

    Integrate to Vendre and find out when e.g. orders & customers are added or changed 

    Get notified in real time

    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.

    Events you can listen to

     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 sent with the event Cart modified

     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.

    Working with webhooks in Vendre

    You can activate and work with webhooks directly in Vendre's administration. Go to Apps & Integration > Webhooks to find them.

    Choice of options

    You can:

    • Enable and disable webhook types.
    • Enable and disable specific webhook links.
    • Enable and disable whether a specific webhook link should send with data.
    • Enable extended data for selected webhooks
    • Remove a webhook type.
    • Remove a specific webhook link.

    Create a webhook

    1. Go to Apps & Integration > Webhooks
    2. Start by clicking on New Webhook and select the event you want to add a webhook for. 
    3. Enter a URL and if you want to Send with data (read more below)
    4. Click Save
    5. Run the event you added to test. Ex. Create an order, a new customer or update a customer. 
    6. Follow the call through the log at the bottom of the page

    Remove a webhook

    If you delete a webhook link, or a webhook type, all logs belonging to that link/type are also deleted.

    How is the webhook sent?

    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.

    Headers

    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". 

    Send with data

    By switching on Send with data, you can choose whether or not the webhook you set up should send relevant data.

    Format and content

    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).

    Extended data (extended objects)

    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.

    products/categories_data

    [
      {
        "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
      }
    ]

    products/specifications

    {
        "generic": [
          {
            "id": 0,
            "value": "string"
          }
        ],
        "value": [
          {
            "id": 0,
            "value": "string"
          }
        ],
        "text": [
          {
            "id": 0,
            "value": {
              "sv": "string",
              "en": "string"
            },
            "short_value": {
              "sv": "string",
              "en": "string"
            }
          }
        ]
      }

    products/tags

    [
      {
        "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
      }
    ]

    Mindset for webhooks

    We recommend not relying solely on webhooks to stay in sync with Vendre. Also sync up to our API regularly.

    Handling cargo at import

    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. 

    • Vad händer om Webhooken inte går fram?

      If the webhook does not reach the recipient's server (e.g. because the server is overloaded or unavailable), an error will be entered in Vendre's administration. However, Vendre does not try again to avoid duplicates being created in the event of an aborted call. 

      If you want to secure the webhooks, you can make night syncs against Vendre's API that keeps the same format for eg. Orders and Customers.

    • Felsökning av webhooks

      You can troubleshoot webhooks by looking at the logs at the bottom of the page.

      These logs are categorized in different tabs based on the different event types you have activated. This way you can easily get a good overview of the webhooks sent out.

      In the view you can also click on two "View" buttons. These open a module box that shows what we sent out in the request, and what we received.

       

      Via https://webhook.site/ you can easily test and inspect webhooks to see how they work without having to trace incoming requests yourself.

    • Begränsningar

      You can specify a maximum of 5 webhook links per event type.

      Webhook links can receive GET parameters of various types, but the link must not contain any YES characters.

      We have a request timeout of 30 seconds.