fulfillmenttools
  • Welcome to the fulfillmenttools Platform Documentation
  • Getting Started
    • Setup your access to fulfillmenttools
    • Make your first API Calls
      • Add your first facility
      • Add your first listing
      • Place your first order
    • Core concepts & terminology
      • Order Flow
    • Postman Collection
    • Client SDKs
    • FAQ
  • Clients
    • Backoffice
      • First steps - Registration
      • Network view
        • Home
        • Orders
          • Unroutable orders
          • Pre-orders & Backorders
          • Order History
        • Inventory Management
          • Stock Overview
          • Channel Inventory
        • Facilities
        • Users
        • Returns
        • DOMS configuration
        • Settings
        • Analytics
          • DOMS Pages
          • Fulfillment Operations Pages
          • Inventory Pages
          • Downloads Page
      • Facility view
        • Home
        • Inbound
        • Tasks
        • Listings
        • Storage Locations
        • Facility
        • Users
    • Inventory app
      • Registration Inventory App
      • App sections
        • Inbound
        • Storage and relocation
    • Operations app
      • Android
        • Manual Registration
        • Android Enterprise Registration
        • Sections
          • Picking
            • Load Units (legacy)
            • Substitute items
            • Weighed or measured products
            • Scanning configuration
            • Picking Methods
              • Batch Picking
              • Multi Order Picking
          • Packing
          • Handover
          • Returns (legacy)
        • Printing
        • Notifications
      • Webapp
        • Packing
      • Overview features Android & Webapp
    • Technical requirements
      • Zebra Hardware Scanner Configuration
      • Honeywell Hardware Scanner Configuration
      • Supported barcodes for camera scanning
      • Requirements for fft applications
      • Zebra printer
    • Returns app
      • Handle unannounced returns
      • Handle announced returns
  • Products
    • Core Functionality
      • Process
        • External actions
      • Add and manage facilities
      • Notification Center
      • Checking on features
      • Tags and Stickers Concept
      • GDPR
      • Remote Configuration
      • Expiry
      • Target time
      • Time calculation for queries of future availabilities (LPS-calculation)
      • Interfacility Transfer
    • Carrier Management
      • Overview
        • Available Carriers
      • Concepts
        • Carrier Country Service Mapping (CCSM)
        • Non-delivery-days
        • Custom Carrier & Headless operation of Carriers
      • Providing needed data
    • Fulfillment Options
      • Fulfillability Check
      • Checkout Options
        • Available fulfillment options based on basket
        • Earliest possible delivery date
        • Available delivery dates within time-period
        • Availability for delivery date
      • Delivery Promise
    • Inventory Management
      • Configurations
      • Entities
        • Listing
        • Stock
          • Stock Properties
        • Storage Location
        • Zone
      • Global Inventory
        • Stock availability
        • Channel Inventory
        • Expected stock
        • Inbound Process
        • Reservations
        • Safety Stock
      • Inventory Control
        • Inventory Traits
        • Measurement Units
        • Outbound Inventory Tracking
        • Storage Location Recommendations
    • Order Fulfillment
      • Headless Order Fulfillment
      • Pick Jobs
      • Zone picking
      • Load Units
      • Custom Service
      • Handover Jobs
      • Add External Documents
      • Configurations
        • Picking Configuration
          • Picking methods
          • Short Pick Reasons
        • Packing Configuration
          • Packing Container Types
        • Print / Document Configuration
        • Tag Configurations
          • Parcel Tag Configuration
        • Handover Configuration
        • Operative Container Types
    • Order Routing
      • Entities
        • Ship-from-Store Orders
        • Click-and-Collect Orders
        • Locked Orders
        • Custom Services Orders
          • Simple Custom Service Order
          • Complex Custom Service Order
      • Fences
      • Ratings
      • Order Split
        • Order split - initial routing
        • Order split after shortpick
        • Item bundles
      • Reroute
      • Shape the routing with the DOMS Toolkit
      • Decision logs
    • Returns Management
      • Returns legacy
        • Available status
      • Returns 2.0
        • Return Reasons
        • Item Conditions
        • Integrating Returns with Events
    • Use Cases
      • Demand-Driven Replenishment
      • Expected stock in availability
      • Multi Order Picking
      • Interfacility transfer
      • Assigned Users
  • Connecting to fulfillmenttools
    • General Topics
      • Use external identity providers to authenticate to fulfillmenttools
        • Microsoft Entra ID / Azure Active Directory (AD)
      • Public Event Export
      • Available Regions
      • Backup Policies
    • GraphQL API
    • RESTful API
      • General Topics
        • API Release Life Cycle
        • Versioning
        • Authorization
        • Customization via Attributes
        • Update Guarantees
        • Rate Limits
        • Resource Timestamps
        • Pagination Interface
        • Localization
        • Custom Attributes
      • OpenAPI Specification
        • Swagger UI
        • OpenAPI 3.0 Spec
    • Eventing
      • Structure of an Event
      • Available Events
      • Tutorial
    • commercetools Connect
    • Integration Tutorial
      • Adding facilities
      • Adding listings to facilities
      • Configuring stocks
      • Carrier configuration
      • Placing orders
      • Checkout Options
      • Distributed Order Management System (Routing)
      • Local fulfillment configuration
  • Incident Reporting
    • How to report incidents in fulfillmenttools
    • How to define incident priorities
  • Release Notes
    • Release Summary – May 2024
    • Release Summary – June 2024
    • Release Summary – July 2024
    • Release Summary – August 2024
    • Release Summary – September 2024
    • Release Summary – October 2024
Powered by GitBook
On this page
  • Create the listening service
  • Creating the subscription at fulfillmenttools
  • Trigger the event
  • Success!

Was this helpful?

  1. Connecting to fulfillmenttools
  2. Eventing

Tutorial

Let's subscribe to Events!

PreviousAvailable EventsNextcommercetools Connect

Last updated 5 months ago

Was this helpful?

This page is outdated. Please go to our new documentation under .

In this tutorial we will subscribe to a specific event that is emitted by fulfillmenttools. We will use the mechanism.

Create the listening service

First we need to create a web endpoint which is publicly available on the internet. For the sake of this tutorial we will leverage a service called . It basically allows you to create a web endpoint in a couple of seconds which will just print out the requests coming in.

This tool is just a suggestion. You can also setup a webhook on your local machine using for example or even create a fully running service in your infrastructure.

In the end we need to have an exposed endpoint. In this example we will use the callbackURL which is provided by webhook.site.

Creating the subscription at fulfillmenttools

Now that we have our service up and running we can create a subscription at fulfillmenttools to receive events. We will register for the ORDER_CREATED event issuing the following call:


curl -sSL -X POST 'https://your.api.fulfillmenttools.com/api/subscriptions' \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "callbackUrl": "https://webhook.site/1c90a559-dd18-4e45-95ec-04821d705466",
    "event": "ORDER_CREATED",
    "headers": [
        {
            "key": "X-My-Auth",
            "value": "Basic ZnVsZmlsbG1lbnR0b29sczppc2Jlc3Q="
        }
    ],
    "name": "Tutorial Subscription (not for productive use)"
}'
201 Created

{
    "callbackUrl": "https://webhook.site/1c90a559-dd18-4e45-95ec-04821d705466",
    "event": "ORDER_CREATED",
    "headers": [
        {
            "key": "X-My-Auth",
            "value": "Basic ZnVsZmlsbG1lbnR0b29sczppc2Jlc3Q="
        }
    ],
    "name": "Tutorial Subscription (not for productive use)",
    "id": "76335286-5e68-434a-b620-e00f953dd098",
    "created": "2022-12-21T17:47:36.650Z",
    "lastModified": "2022-12-21T17:47:36.650Z"
}

That's it. You just created your very first subscription, which is triggered whenever an Order has been created.

Trigger the event

In order to complete this tutorial we need to create an Order and see whether the subscription to the event ORDER_CREATED works.

curl -sSL -X POST 'https://your.api.fulfillmenttools.com/api/orders' \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "orderDate": "2022-12-22T08:16:07.000Z",
    "consumer": {
        "addresses": [
            {
                "street": "Schanzenstr.",
                "houseNumber": "30",
                "postalCode": "51063",
                "city": "Cologne",
                "country": "DE",
                "firstName": "Luke",
                "lastName": "Skywalker"
            }
        ]
    },
    "tenantOrderId": "FC-4711-2361",
    "orderLineItems": [
        {
            "article": {
                "tenantArticleId": "2020249",
                "title": "T-Shirt \"Am Sonnenhut\"",
                "attributes": [
                    {
                        "category": "descriptive",
                        "priority": 100,
                        "key": "%%subtitle%%",
                        "value": "Newly arrived!"
                    },
                    {
                        "category": "descriptive",
                        "priority": 200,
                        "key": "Best-Price",
                        "value": "17,96 EUR"
                    },
                    {
                        "category": "descriptive",
                        "priority": 300,
                        "key": "Cut",
                        "value": "Women"
                    },
                    {
                        "category": "descriptive",
                        "priority": 400,
                        "key": "Material",
                        "value": "100% Cotton"
                    },
                    {
                        "category": "descriptive",
                        "priority": 500,
                        "key": "Article No.",
                        "value": "2020249"
                    },
                    {
                        "category": "descriptive",
                        "priority": 600,
                        "key": "Size",
                        "value": "S"
                    },
                    {
                        "category": "descriptive",
                        "priority": 700,
                        "key": "Decription",
                        "value": "Rotes T-Shirt mit weißen Streifen an den Ärmeln, Blockdruck mit Schriftzug auf der Brust"
                    }
                ]
            },
            "quantity": 1,
            "scannableCodes": [
                "2020249"
            ]
        }
    ]
}
'
201 Created

<Response body ommitted>

A couple of seconds later the event is being delivered to our client. It is shown in the following way:

Complete answer:

Headers:
connection	close
content-length	1422
content-type	application/json
x-my-auth	Basic ZnVsZmlsbG1lbnR0b29sczppc2Jlc3Q=
accept-encoding	gzip, deflate
host	webhook.site
traceparent	00-c922c8509f5d7482787d97d8040716c5-64dcf668569bfcc9-01

Body:
{
  "event": "ORDER_CREATED",
  "payload": {
    "orderDate": "2022-12-22T08:16:07.000Z",
    "consumer": {
      "addresses": [
        {
          "street": "Schanzenstr.",
          "houseNumber": "30",
          "postalCode": "51063",
          "city": "Cologne",
          "country": "DE",
          "firstName": "Luke",
          "lastName": "Skywalker"
        }
      ]
    },
    "tenantOrderId": "FC-4711-2361",
    "orderLineItems": [
      {
        "article": {
          "tenantArticleId": "2020249",
          "title": "T-Shirt \"Am Sonnenhut\"",
          "attributes": [
            {
              "category": "descriptive",
              "priority": 100,
              "key": "%%subtitle%%",
              "value": "Newly arrived!"
            },
            {
              "category": "descriptive",
              "priority": 200,
              "key": "Best-Price",
              "value": "17,96 EUR"
            },
            {
              "category": "descriptive",
              "priority": 300,
              "key": "Cut",
              "value": "Women"
            },
            {
              "category": "descriptive",
              "priority": 400,
              "key": "Material",
              "value": "100% Cotton"
            },
            {
              "category": "descriptive",
              "priority": 500,
              "key": "Article No.",
              "value": "2020249"
            },
            {
              "category": "descriptive",
              "priority": 600,
              "key": "Size",
              "value": "S"
            },
            {
              "category": "descriptive",
              "priority": 700,
              "key": "Decription",
              "value": "Rotes T-Shirt mit weißen Streifen an den Ärmeln, Blockdruck mit Schriftzug auf der Brust"
            }
          ]
        },
        "quantity": 1,
        "scannableCodes": [
          "2020249"
        ],
        "id": "d0a54077-1427-457c-9859-01ec7d13adb4"
      }
    ],
    "deliveryPreferences": {
      "shipping": {
        "serviceLevel": "DELIVERY"
      }
    },
    "status": "OPEN",
    "id": "0fa8b609-7038-4450-85b1-1ca2fe7c7f9d",
    "tags": [],
    "processId": "a72007e1-d04a-4c38-8079-c2aec8a5034f",
    "created": "2022-12-21T17:54:34.967Z",
    "lastModified": "2022-12-21T17:54:34.967Z",
    "schemaVersion": 1,
    "version": 1
  },
  "eventId": "5993095975110686"
}

Please take note of the x-my-auth header, which we supplied when creating the subscription. Also the event gets an eventId, the event name and, of course, the entity itself as payload.

Success!

You just finished this tutorial showing how to connect to specific events in an asynchronous way. The event can be used for example to trigger further processes on the provided service or to integrate into existing infrastructure.

https://docs.fulfillmenttools.com/documentation
Eventing
https://webhook.site/
https://ngrok.com/
https://webhook.site/1c90a559-dd18-4e45-95ec-04821d705466
The service webhook.site after the webhook has been created
Screenshot