Feature: #98373 - Reactions - Incoming webhooks for TYPO3

See forge#98373

Description

This feature adds the possibility to receive webhooks in TYPO3.

With the new System > Reactions backend module it is possible to configure the reactions triggered by any webhook.

A webhook is defined as an authorized POST request to the backend.

The core provides a basic default reaction that can be used to create records triggered and enriched by data from the caller.

Additionally, the Core provides the \TYPO3\CMS\Reactions\Reaction\ReactionInterface to allow extension authors to add their own reaction types.

Any reaction record is defined by a unique uid (UUID) and also requires a secret. Both information are generated in the backend. The secret is only visible once and stored in the database as an encrypted value like a backend user password.

Next to static field values, the "create record" reaction features placeholders, which can be used to dynamically set field values by resolving the incoming data from the webhook's payload. The syntax for those values is ${key}. The key can be a simple string or a path to a nested value like ${key.nested}.

Definition of the placeholders in the record

${title}
${description}
${key.nested}
Copied!

Example payload for placeholders

{
    "title": "My title",
    "description": "My description",
    "key": {
        "nested": "bar"
    }
}
Copied!

By default, only a few tables can be selected for external creation in the create record reaction. In case you want to allow your own tables to be available in the reactions' table selection, add the table in a coresponding TCA override file with:

if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('reactions')) {
    \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem(
        'sys_reaction',
        'table_name',
        [
            'label' => 'LLL:EXT:myext/Resources/Private/Language/locallang.xlf:my_table',
            'value' => 'my_table',
            'icon' => 'myext-my_table-icon',
        ]
    );
}
Copied!

In case your extension depends on EXT:reactions the isLoaded() check might be skipped. Please note that tables with adminOnly set are not allowed.

Impact

This feature allows everybody to provide additional value for any TYPO3 instance. By reacting to webhooks, TYPO3 can now be used to create records in the backend. Furthermore, by implementing the ReactionInterface, it is possible to create any custom reaction.