External actions

Introduction

The "External Actions" feature empowers users to trigger and execute actions and processes in external systems, outside of fulfillmenttools.

  • Multiple external actions can be added to a process.

  • External actions can be grouped and assigned to a theme

This example adds a link to a payment provider.

POST {{host}}/api/externalactions

{
      "processRef": "PROCESS-REF-TO_WHICH_THE_ACTION_SHOULD_REFER",
      "nameLocalized": {
        "en": "Zahlungen anpassen",
        "de": "Adjust Payment"
      },
      "groups": [
        "string"
      ],
      "action": {
        "type": "BLANK_LINK",
        "linkUrl": "yourpaymentprovider.com/xyz..."
      }
    }

Define a external action with Type FORM

POST {{host}}/api/externalactions

{
    "processRef": "6aca1c80-c418-4064-b173-63fb120aef2d",
    "groups": ["Trainingsgruppe B"],
    "nameLocalized": {
        "de_DE": "Zahlungen anpassen",
        "en_US": "Adjust payments"
    },
    "action": {
        "type": "FORM",
        "elements": [
            {
                "elementType": "HEADLINE",
                "title": "Adjust payments for this order", // Returns value from "titleLocalized"
                "titleLocalized": {
                    "de_DE": "Zahlungen zu dieser Bestellung anpassen",
                    "en_US": "Adjust payments for this order"
                }
            },
            {
                "elementType": "SUBHEADLINE",
                "title": "In this modal you can make payment adjustments. This can either be a percentual or a freely selected discount.", // Returns value from "titleLocalized"
                "titleLocalized": {
                    "de_DE": "In diesem Modal können Sie Zahlungsanpassugen vornehmen. Dies kann entweder ein prozentualer oder ein frei gewählter Rabatt sein.",
                    "en_US": "In this modal you can make payment adjustments. This can either be a percentual or a freely selected discount."
                }
            },
            {
                "elementType": "TEXT",
                "style": "BODY",
                "title": "string", // Returns value from "titleLocalized"
                "titleLocalized": {
                    "de_DE": "-",
                    "en_US": "-"
                }
            },
            {
                "elementType": "TEXT",
                "style": "BODY",
                "title": "string", // Returns value from "titleLocalized"
                "titleLocalized": {
                    "de_DE": "Rabatt in %",
                    "en_US": "Discount in &"
                }
            },
            {
                "elementType": "TEXT_INPUT",
                "elementId": "4712",
                "label": "string", // Returns value from "labelLocalized"
                "titleLocalized": {
                    "de_DE": "%",
                    "en_US": "%"
                },
                "isMandatory": false,
                "validation": {
                    "validationType": "FLOAT",
                    "minValue": 1, // OPTIONAL
                    "maxValue": 100 // OPTIONAL
                }
            },
            {
                "elementType": "TEXT",
                "style": "BODY",
                "title": "string", // Returns value from "titleLocalized"
                "titleLocalized": {
                    "de_DE": "-",
                    "en_US": "-"
                }
            },
            {
                "elementType": "TEXT",
                "style": "BODY",
                "title": "string", // Returns value from "titleLocalized"
                "titleLocalized": {
                    "de_DE": "Rabatt in €",
                    "en_US": "Discount in €"
                }
            },
            {
                "elementType": "TEXT_INPUT",
                "elementId": "4713",
                "label": "string", // Returns value from "labelLocalized"
                "titleLocalized": {
                    "de_DE": "€",
                    "en_US": "€"
                },
                "isMandatory": false,
                "validation": {
                    "validationType": "INTEGER",
                    "minValue": 1, // OPTIONAL
                    "maxValue": 1000 // OPTIONAL
                }
            },

            {
                "elementType": "TEXT",
                "style": "INFO",
                "title": "string", // Returns value from "titleLocalized"
                "titleLocalized": {
                    "de_DE": "Die Anpassung der Abrechnung wird durch ein Fremdsystem durchgeführt.",
                    "en_US": "The billing adjustment is carried out by a third-party system."
                }
            }
        ],
        "success": {
            "label": "string", // Returns value from "labelLocalized"
            "labelLocalized": {
                "de_DE": "Bestätigen",
                "en_US": "CONFIRM"
            }
        },
        "cancel": { // OPTIONAL
            "label": "string", // Returns value from "labelLocalized"
            "labelLocalized": {
                "de_DE": "Abbrechen",
                "en_US": "CANCEL"
            }
        }
    }
}

Subscribe to an external action event

It is possible to create a subscription to receive events when executing an external action. You will be informed when the action has been executed, e.g., by clicking on a link.

In this example, a subscription is created to receive events when an external action is executed.\

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": "EXTERNAL_ACTION_EXECUTED",
"headers": [
{
"key": "X-My-Auth",
"value": "Basic ZnVsZmlsbG1lbnR0b29sczppc2Jlc3Q="
}
],
"name": "EXTERNAL_ACTION_EXECUTED"

Add information to a process and relate it to another action

First an external action with type "COMMENT" is added to an existing order. This enables you to add generally information to an order

Such a POST call might look like this:

POST {{host}}/api/externalactions

{
    "processRef": "PUT-IN-A-PROCESS-ID",
    "nameLocalized": {
        "de_DE": "Zusatzinformation Kunde",
        "en_US": "Additional customer information",
    },
    "groups": [
        "Additional information"
    ],
    "action": {
        "type": "COMMENT"
    }
}

After that you add the actual information with

POST {{host}}/api/externalactions/externalActionRef/logs

{
  "requiresAnonymization": false,
    "actionPayload": {
    "comment": "Consumer seqment A - high priority",
    "externalActionRef":"optional-ref"
  }
}

Note: The externalActionRef is option

Last updated