# 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

# Configure Slack App

At: https://api.slack.com/apps/ (opens new window) click on Create new app slack_app-listing.png

Select "from scratch" in the context window slack_app-choose.png

Give a meaningful app name, select your workspace and click on Create App slack_app-naming.png

After saving, select in the overview "Incoming Webhooks". slack_app-webhooks.png

Activate the webhook slack_app-webhooks_activate.png

Click on "Add New Webhook to Workspace". slack_app-webhooks_code.png

Assign the webhook to an existing channel where the order information should be posted. slack_app-webhooks_add-channel.png

Copy the sample code (Sample curl request) and execute it in a terminal. slack_app-webhooks_info.png

In Slack, the test message should now be displayed in the channel. slack_channel.png

# 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 and UTF-8 for the character set.
  • In the template enter (test) :
{"text": "Order: {{order.orderNumber}}\nOrder value: {{order.price.totalPrice}} {{order.currency.translated.shortName}}"}
1

eoe_profile-detail.png

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

eoe_flow-detail_action-add.png

  • 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

eoe_flow-detail_action-detail.png

  • 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.

slack_message.png