> ## Documentation Index
> Fetch the complete documentation index at: https://dokumentation.websale.de/llms.txt
> Use this file to discover all available pages before exploring further.

# ASSE- (Asynchronous data transfer)

> The two tags for Asynchronous Server Side Events: trigger an event from the template and check whether an error occurred.

With an Asynchronous Server Side Event, the shop sends data to an external system without waiting for its response. Page rendering continues, and the transfer takes place in the background.

Only two tags are needed in the template for this: `ASSE-Fire()` triggers an event, `ASSE-LastErrorCode` tells you whether it worked.

Guide: Asynchronous Server Side Events

## What actually happens when an event is triggered

The tag does not send the data itself. It stores the event as a file in a spool directory, and a separate process delivers it from there, with retries if the recipient cannot be reached.

This has two consequences for template work:

* Page rendering is not held up, even if the target system responds slowly or not at all.
* The template does not learn whether the transfer was ultimately successful. `ASSE-LastErrorCode` only reports whether the event could be accepted and stored at all.

> [!NOTE]
>
> These tags are therefore not suitable for feedback to the visitor. They are intended to notify another system, not to fetch a response.

## Prerequisites

Three things must be in place before an event can be triggered at all:

| Prerequisite | Where it is set |
| - | - |
| The function is enabled for the shop | by WEBSALE |
| The spool directory is set up | global configuration `websale8.cfg` |
| The event is created with an ID | `shop.config`, section `<ASSE>` |

An entry in the `<ASSE>` section defines, among other things, the ID under which the event is addressed in the template, the recipient's address, the HTTP method, the name of the payload parameter, the content type, and the conditions under which a response is considered successful.

Reference: Section ASSE

## Triggering an event

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
~ASSE-Fire(bestellung-abgeschlossen,~BASKET-OrderNumber~)~
```

The tag itself outputs nothing. It only triggers, and can therefore only be used as a single tag, but in all templates.

| Tag | Single tag | Area tag | Negative area tag | Loop tag |
| - | - | - | - | - |
| `ASSE-Fire()` | yes | – | – | – |
| `ASSE-LastErrorCode` | yes | yes | yes | – |

### ASSE-Fire()

Triggers the event with the specified ID and passes it the specified data.

| Parameter | Meaning |
| - | - |
| 1 | ID of the event from the `<ASSE>` section of `shop.config` |
| 2 | Payload, i.e. the data that is transferred |

Both parameters support tag-in-tag, so the data can be assembled from other tags.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
~ASSE-Fire(bestellung-abgeschlossen,{"nummer":"~BASKET-OrderNumber~","summe":"~BASKET-OrderTotal~"})~
```

> [!WARNING]
>
> Both parameters are mandatory. If the second is missing, the tag is invalid and triggers nothing. If no content is to be sent, explicitly pass an empty value instead of omitting the parameter.

> [!WARNING]
>
> The tag triggers on every page render in which it appears. Therefore, wrap it so that it only takes effect in the desired case, for example on the order confirmation page only if an order has actually been placed. Otherwise, a page reload by the visitor triggers the event a second time.

> [!NOTE]
>
> In the payload, watch out for characters that have a meaning in the tag itself. Otherwise, a comma in the payload separates parameters that are not meant to be separated.

## Checking whether it worked

### ASSE-LastErrorCode

Outputs the result code of the most recently triggered event. As an area tag, it applies if an error has occurred.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
~ASSE-Fire(bestellung-abgeschlossen,~BASKET-OrderNumber~)~

{ASSE-LastErrorCode}
   Fehler bei der Datenübermittlung, Code: ~ASSE-LastErrorCode~
{/ASSE-LastErrorCode}

{!ASSE-LastErrorCode}
   Es ist kein Fehler aufgetreten.
{/!ASSE-LastErrorCode}
```

> [!WARNING]
>
> As a single tag, `ASSE-LastErrorCode` always outputs a number, 0 in case of success. Therefore, only use it within the bracket. Otherwise a lonely 0 appears on the page.

> [!NOTE]
>
> The tag only ever holds the result of the most recently triggered event. If you trigger several on one page, check each one individually directly after its `ASSE-Fire()`, otherwise you only see the last result.

### Meaning of the codes

Not every error is a case for WEBSALE support. Some of them originate in the template itself.

| Code | Meaning | Where to start |
| - | - | - |
| 0 | no error, the event was stored | – |
| 1 | The function is not enabled for this shop | WEBSALE contact person |
| 2 | No spool directory in the global configuration | WEBSALE contact person |
| 3 | No ID was passed | Template |
| 4 | There is no entry for this ID in the `<ASSE>` section | Template or `shop.config` |

> [!NOTE]
>
> Code 4 is the most common and also the one you can fix yourself. It almost always means a typo in the ID or an entry that is still missing in `shop.config`. First compare the spelling in the tag with that in the `<ASSE>` section.

> [!NOTE]
>
> Codes beyond this list concern writing the event file and are a case for your WEBSALE contact person.

## Related topics

* Guide: Asynchronous Server Side Events
* Guide: Exchanging data with external systems
* Reference: Section ASSE


## Related topics

- [Exchanging data with external systems](https://dokumentation.websale.de/en/v8s/externe-dienste/daten-mit-externen-systemen-austauschen.md)
- [External services and interfaces](https://dokumentation.websale.de/en/v8s/referenz/konfigurationen/shopkonfiguration-shop-config/externe-dienste-und-schnittstellen.md)
- [$wsAsse - Asynchronous HTTP events (ASSE)](https://dokumentation.websale.de/en/frontend/referenz/module/wsasse.md)
- [ASSE interface (server-side events)](https://dokumentation.websale.de/en/schnittstellen/asse-schnittstelle-server-side-events.md)
- [CBPOD- (Enriching order data)](https://dokumentation.websale.de/en/v8s/referenz/tags/cbpod.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.