# Slack
# Task
In a Slack channel, the order data is to be displayed when an order is placed.
TIP
Any data from events can be passed to Slack. This example only serves to illustrate the basic process. Besides Slack, other connections are also possible that provide a WebHook or API.
# Requirements
- If not available, Create Slack Account (opens new window)
- Slack Channel in which the information is to be posted.
# Configure Slack App
At: https://api.slack.com/apps/ (opens new window) click on Create new app
Select "from scratch" in the context window
Give a meaningful app name, select your workspace and click on Create App
After saving, select in the overview "Incoming Webhooks".
Activate the webhook
Click on "Add New Webhook to Workspace".
Assign the webhook to an existing channel where the order information should be posted.
Copy the sample code (Sample curl request) and execute it in a terminal.
In Slack, the test message should now be displayed in the channel.
# Configure ExportOnEvent
# Create profile
Create a new profile under Administration>Settings>Extensions>ExportOnEvent
.
- Assign a name
- Activate the profile
- Select a trigger of your choice for Trigger - in this example select
Order received
. - Select
JSON
for the file type andUTF-8
for the character set. - In the template enter (test) :
{"text": "Order: {{order.orderNumber}}\nOrder value: {{order.price.totalPrice}} {{order.currency.translated.shortName}}"}
Message formatting
Slack allows formatting of the message in MarkDown format. Here (opens new window) you can find more information about message formatting. With the Slack BlockBuilder (opens new window) you have the possibility to customise your messages even more.
Of course, all other order data can be transferred.Of course, all other order data can be transferred.
- Check the data with the preview.
# Create flow
Create a new flow under Administration>Settings>Shop>Flow Builder
.
- Give it a name and switch to the "Flow" tab.
- Select the trigger
Order Completion / Order / Inbox
. - Select an action to add
- Select
Webhook
in the select field under "ExportOnEvent
- The configuration form opens
- Enter the webhook URL of Slack in the URL field (see Slack configuration).
- Select the method
Post
. - Select the previously created profile for the export profile
- Now you can test the action. Click on
Test
and choose a sales channel and an order. - In the SlackChannel you should now find the information.