# Stickers

Stickers can be added to various entities. They can show information that is helpful during order processing or for display in the Backoffice and in mobile applications. They also include language localization features to facilitate understanding for human users.

Different from [tags](https://docs.fulfillmenttools.com/documentation/getting-started/tags), stickers don't have to be known to fulfillmenttools before being used.

{% hint style="warning" %}
Stickers aren't used to make business decisions, they only have an informative character. If connectors should make decisions based on a value, use tags instead.
{% endhint %}

## Working with stickers

Stickers can be added on entities via their respective API, or can automatically be added if configured in tags. That means if the entity has a tag at creation, the sticker for this tag will be added automatically. Entities with such a tag-sticker configuration are:

* order: [REST API documentation](https://fulfillmenttools.github.io/fulfillmenttools-api-reference-ui/#put-/api/configurations/tags/order)
* pick job: [REST API documentation](https://fulfillmenttools.github.io/fulfillmenttools-api-reference-ui/#get-/api/configurations/tags/pickjob)
* pack job: [REST API documentation](https://fulfillmenttools.github.io/fulfillmenttools-api-reference-ui/#get-/api/configurations/tags/packjob)
* handover job: [REST API documentation](https://fulfillmenttools.github.io/fulfillmenttools-api-reference-ui/#get-/api/configurations/tags/handoverjob)

Stickers are not inherited from one entity to another.

A **sticker** is a visual indicator that can be attached to entities within fulfillmenttools to highlight important information. For example, a sticker can signal that an order is a high-priority shipment or requires special handling.

There are two primary methods for applying stickers to entities.

## Adding stickers at entity creation

To add stickers directly to an entity at creation, include the `stickers` array in the request payload.

The following example demonstrates how to add a sticker during the creation of an `order`.

```http
POST https://{projectId}.api.fulfillmenttools.com/api/orders
```

```json
{
    "tenantOrderId": "A-57636-274",
    "orderLineItems": [
        ...
    ],
    "stickers": [
        {
            "key": "information",
            "priority": 100,
            "nameLocalized": {
                "de_DE": "Wichtig",
                "en_US": "Important"
            }
        }
    ],
    ...
}
```

## Adding stickers via tags

Stickers can also be applied automatically based on an entity's tags. This functionality requires defining a `tag-sticker-configuration` for the relevant entity type.

These configurations are managed using the API. A `tag-sticker-configuration` can be defined for the following entities:

* [Order tag-sticker configuration](https://fulfillmenttools.github.io/fulfillmenttools-api-reference-ui/#put-/api/configurations/tags/order)
* [Pick job tag-sticker configuration](https://fulfillmenttools.github.io/fulfillmenttools-api-reference-ui/#get-/api/configurations/tags/pickjob)
* [Pack job tag-sticker configuration](https://fulfillmenttools.github.io/fulfillmenttools-api-reference-ui/#get-/api/configurations/tags/packjob)
* [Handover job tag-sticker configuration](https://fulfillmenttools.github.io/fulfillmenttools-api-reference-ui/#get-/api/configurations/tags/handoverjob)

## Show stickers to clients

There are two methods to display a sticker in fulfillmenttools clients, such as the network order overview in Backoffice.

{% hint style="info" %}
Both options can be used together.
{% endhint %}

## Directly assigning stickers during order creation

The first method involves attaching a `sticker` directly to an `order` payload during its creation. When fulfillmenttools processes this `order`, the `sticker` is displayed in client applications like Backoffice. This also enables filtering orders based on assigned stickers.

An example `order` payload with a `sticker` is shown below.

```http
POST https://{projectId}.api.fulfillmenttools.com/api/orders
```

```json
{
  "tenantOrderId": "4711",
  ...
  "stickers": [
    {
      "key": "customercategory",
      "priority": 100,
      "nameLocalized": {
        "de_DE": "A-Kunde",
        "en_US": "A-Customer"
      },
      "color": "#19b6b5"
    }
  ],
  ...
}
```

## Automatically assigning stickers via tags

The second method is to attach a `tag` to an `order` and create a configuration that automatically assigns a `sticker` when the `order` enters the system. This configuration-based approach can also be used to assign stickers to other entities.

This example assumes a `tag` is already configured in the system:

```http
GET https://{projectId}.api.fulfillmenttools.com/api/tags
```

```json
{
    "id": "Channel",
    "allowedValues": [
        "B2B",
        "B2C"
    ],
    "created": "2023-04-03T09:28:59.336Z",
    "lastModified": "2023-04-03T09:28:59.336Z",
    "version": 1
}
```

Next, a configuration is created to map specific `tag` values to `stickers` for the `order` entity. The following example demonstrates this configuration:

```http
PUT https://{projectId}.api.fulfillmenttools.com/api/configurations/tags/order
```

```json
{
    "stickerConfiguration": {
      "offeredStickersByTag": [
        {
          "tagRef": "Channel",
          "matchingValues": [
            "B2B"
          ],
          "stickers": [
            {
              "key": "CustomerType",
              "priority": 100,
              "nameLocalized": {
                "de_DE": "Firmenkunde",
                "en_US": "Business Customer"
              },
              "name": "Firmenkunde",
              "color": "#9919b6"
            }
          ]
        },
        ...
      ]
    }
  ...
}
```

With this configuration in place, new orders created with the `Channel` `tag` will automatically have the corresponding `CustomerType` `sticker` assigned:

```http
POST https://{projectId}.api.fulfillmenttools.com/api/orders
```

```json
{
    "tenantOrderId": "4711",
    ...
    "tags": [
        {
            "id": "Channel",
            "value": "B2B"
        }
    ],
    ...
}
```
