Get access to free tutorials, exclusive content and more.

Create Conditional Slack Notifications From WordPress Form Submissions

Do you need to stay organized but don’t want to flood the same Slack channel with notifications that do not belong there? Want to make sure that only the appropriate channels or individuals get notified about submitted WordPress form entries? Look no further for the solution.

In this tutorial, we will show you how to create conditional Slack notifications from WordPress form submissions using our powerful conditional logic plugin. Without further ado, let’s organize your Slack communication!

How to conditionally route Slack notifications from WordPress

Assuming you have your Slack add-on and Conditional Logic add-on installed on your form, it will only take three simple steps to generate conditional Slack notifications including adding a list field to your form, creating multiple Slack actions, and creating conditions for which the action will process.

Step 1: Create a Slack channels list for your WordPress form

To give your users a choice of what Slack channel they want their form submission to go to, create a field that allows them to choose one or more options from a set of predefined choices. The following form fields are supported: Select field (dropdown), Radio List, Checkbox List, and Multi-Select field.

Add the desired field to your form. Add a label and value to each option that corresponds with the Slack channel you want their submission to be associated with.

WARNING: If you aren’t seeing a place to add values in your desired field make sure ‘Dev Mode’ has been enabled. Enabling this feature will give you access to advanced settings. To enable navigate to Ninja Forms > Settings > Advanced Settings > click ‘Dev Mode’.

It’s extremely important to add values, not just labels to the Options fields in your list. Otherwise, you will experience mapping issues with Conditional Logic, so make sure those have been accounted for before you move on.

Slack Channel List, Slack notifications from wordpress

Step 2: Add a Slack Action for Each Slack Channel

Create a Slack action for each Slack channel, you wish to send your newly created Slack notification(s). Add the action by clicking the blue/+ icon at the bottom right of the Email & Actions screen. 

The number of actions you can have is unlimited, but keep in mind that excessive action use will slow your website down. After you have added all the Slack actions that you think you will need, start setting up each action with the following:

  • Message – Add values manually or with the use of merge tags
  • Slack URL – Webhook URL for Your Workspace/Channel

Multiple Slack actions

Want to learn more about form actions in Ninja Forms? We recommend you check the article The Definitive Guide to Using Form Actions. This tutorial is packed with useful tips and examples on how to use specific form actions on your WordPress form.

Step 3: Create Slack Webhook for each Slack action

See, Retrieve the Slack Webhook, and complete the process for each action. Once you have all the webhooks created for each channel, copy them into the Slack URL field.

Step 4: Add a Conditional Statement to Each Slack Action

Set the trigger condition based on the channel associated with the webhook. Open the Conditional Logic settings found in the action. This will help you determine which Slack channel you want the notification to go to.

conditional statement setting the Slack channel the notification for user-published posts will go to

Open the first dropdown to choose your field. Extend the second dropdown to reveal the conditional statement ( Has Selected or Does Not Have Selected). Expanding the third dropdown will auto-populate values from the field you selected. Pick the value and then repeat the process with your subsequent Slack actions. completed conditional notifications for user-published posts

Publish and test your form. You will know everything is working when you receive a notification in one of your Slack channels. If you do not, you will need to review your Slack action and app settings.

Creating lists based on the workspace/channels is just one of many ways in which you can conditionally set your Slack actions. You could also send the Slack notification from WordPress to a specific workspace/channel based on a specific email address.

For this, select the email field, select Equals, and input your desired email address. Not sure how to set up email action conditionally? Check our documentation Sending Conditional Email with Ninja Forms.

You can now create conditional Slack notifications from WordPress

This is exciting! You’ve just learned how to create conditional Slack notifications from WordPress. I think we both agree that it is a pretty easy thing to do using our powerful Conditional Logic add-on.

Proven by many Ninja Forms users, it takes a minimum effort to learn how to use this conditional plugin for WordPress. And the best part? The Conditional Logic functionality takes your form to another level by unlocking multiple awesome features, including the following:

  • Reveal options, fields, and values based on user choices (show/hide fields)
  • Edit field values and perform calculations conditionally
  • Reconfigure the list based on user selections
  • Set conditions to determine if and who receives responses (send conditional email)
  • Show different success messages based on form selections
  • Set redirect destinations conditionally
  • Add subscribers to different subscription lists based on user responses & much more

The good news is you can get a Conditional Logic add-on individually for 1, 5, or 20 licenses without signing up for a membership plan. Plus, the Ninja Forms core plugin is free so you don’t need to worry about breaking the bank. You’ll get plenty of free features already included, and with a 14-day money-back guarantee for all our products, you have nothing to lose!