EDD Slack – Creating Notifications
Now that you have a Default Webhook URL set, it is time to set up some Notifications!
EDD Slack allows you to configure an unlimited number of Notifications to be sent to any specified Channel in your Slack Team. Simply navigate to the settings page (Downloads → Settings → Extensions → Slack)and click “Add Slack Notification” to bring up the configuration form. These settings can be edited later at any time.
Here’s a Description of what each field does:
- Identifier for this Notification: This field is simply a label for you and helps you determine which saved Notification does what. You can enter whatever you’d like here. If nothing is entered, it will default to “New Slack Notification”.
- Slack Trigger: Defines the Trigger which results in this notification sending a message to Slack. This can be an action within Easy Digital Downloads or another supported Easy Digital Downloads Extension. Based on the choice of Trigger, additional fields will be added to the Form and different Text Replacements for the Message Pre-text, Message Title, and Message fields will become available so that pertinent information about the Notification can be passed to Slack.
- Message Pre-text: Optional text which shows above the Message Title.
- Message Title: This allows you to control the Message Title. If nothing is entered, this will default to the Notification Identifier above.
- Message: This is an optional field where you can enter more descriptive text within the Notification below the Pre-Text and the Title.
- Slack Webhook URL: Allows for an alternate Webhook URL to be used in special cases. This can be used in an event where a Notification should be sent to a different Team than the one that is defined for the Default Webhook.
- Slack Channel: This allows you to override the Slack Channel of the Webhook for this particular Notification. If you desire to send notifications to a specific Slack User in your Team, use the
@username
syntax. Leave blank for Default Channel defined by the Webhook. Remember, this Channel needs to be one that the creator of the Webhook URL has access to! - Color: Messages sent to Slack will have this color appear in a bar before the message.
- Username: Defines the name of the User that the message will appear to be from. The User does not need to exist in Slack and this can be set to anything you’d like. This will default to the name of your WordPress site.
- Icon Emoji or Image URL: If the default image or emoji used for notifications isn’t your style, this field will allow for custom graphics to be specified. You can also set any created Custom Slack Emoji that you want for this field.
- Additional fields will also appear depending on the selected Slack trigger. These allow you to specify for which Downloads a Trigger should send a Notification for example.
When a Slack Trigger is chosen, additional Fields and Text Replacement tags are added to the Form. For example, here’s what you will see when choosing the “Purchase Complete” Trigger:
The Text Replacement tags allow information about the Trigger to be added to the content of the Notification. This way you can see the contents of a cart for a Purchase, the Total, and other bits of information based on the chosen Trigger.
Once the Form has been filled out to your liking, click the “Save Slack Notification” button at the bottom of the form. This will close out the Form and bring you back to the screen you were at before and flash the Notification green to show that it has Saved. The green Checkmark will show that the Notification is Active. Congratulations, you have configured your first Slack Notification!
If instead of a green Checkmark you see a red “X”, the notification is Inactive. This can happen for one or more of the following reasons:
- A Webhook URL was not set as the Default or otherwise provided as part of the Form.
- The form was closed out without Saving.
- A previously saved Notification was using a Trigger that is no longer available. This can happen when a plugin that integrates with EDD Slack gets disabled.