Receiving WordPress form notifications for user-published posts isn’t just for email anymore. Email is out, and communication services like Slack are in. If you already spend your day in Slack, communicating with your team, it only makes sense to send your WordPress form notifications there as well. After all, email is officially dead, at least according to Slack 😜
In this article will show you how to set up Slack notifications for user-submitted posts the second a user creates new content. Need an easy way to organize your workflow? We will show you how to do that by using Conditional Logic.
Sending notifications for user-published posts to your Slack workspace is a breeze! So let’s get started.
Table of Contents
- Configure Front-End Posting
- Generate Slack notifications for user-published posts
- How to sort your Slack notifications for user-published posts by Slack channel
Getting Started
First, create a Slack workspace for your user-published notification. Next, install the Front-End Posting, Slack, and Conditional Logic ( optional ) add-ons to your WordPress website. If you are having trouble see our installation guide for help.
Configure Front-End Posting ( Post Creation )
Head over to Ninja Forms > Add New > Create a Post. Review the form template and adjust the form fields according to your needs. For an in-depth guide, see Post Creation.
In Email & Actions ensure the Create a Post action is enabled. Notice that the form fields generated by Create a Post map to their respective fields. From here, no further action is required.
If additional form fields were added read, How to Enable User Submitted Post and Content with Ninja Forms for an in-depth guide to the Create a Post action.
Generate Slack notifications for user-published posts
Step 1: Configure the Slack action
Add the Slack action to your form’s Email & Actions section by clicking the blue/+ icon at the bottom right and selecting Slack. Rename the action, Content Notifications. Labeling your actions keeps them organized and ready for future uses.
Within the Message field, add the Create a Post and WordPress merge tags by clicking on the merge-tag icon to the right of the field.
- {post:permalink} – provide a link to the URL of the authors draft
- {wp:post_author} – displays the name of the author.
- {wp:post_author_email} – displays the authors email address
Next, add the Your Title ( Single-Line Text ) and Your Content ( Paragraph Text ) merge tag.
Finish customizing the field to your preference. Remember, this is a notification message, so it should be concise. Only include what you want to see as a Slack notification of user-published posts. Here is a quick example of what mine looks like:
Step 2: Retrieve and apply the Slack Webhook URL for your workspace
Create a New App by navigating to api.slack.com. For detailed instructions on the app creation process, see our documentation. After successfully creating your app, click on the Incoming Webhooks menu option and enable the Activate Incoming Webhooks switch. Copy the newly created Webhook URL to your clipboard. Add the webhook to the Slack URL field in the Slack action.
Add your Slack webhook to the Slack URL field.
Publish and test your form. You will know everything is working if you receive a notification. If you do not, you will need to review your Slack action.
Once you receive the alert, click on the post link to automatically preview what users have written ( this will work as long as you are logged in to your WordPress site ).
How to sort your Slack notifications for user-published posts by Slack channel
Automatically curate users’ posts into separate channels so you and your team can stay organized.
Step 1: Create a Slack channels list for your WordPress form
Create a pre-defined list field to give your users the option to choose which Slack channel they want their notification for user-published posts to go. This can be achieved by using a Select, Radio List, Checkbox List, or Multi-Select field.
Add the desired field to your form by clicking the blue/circle + icon at the bottom right. Drag-and-drop the field into place. 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’.
Make sure you have added the 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.
Step 2: Create a Slack Action for Each Slack Channel
Create a Slack action for each 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.
There is no limit to the number of actions you can have, so go wild. Just keep in mind that excessive action use will SLOW your website down. Check out The Definitive Guide to Using Form Actions for more tips and tricks.
After you have added all the Slack actions that you think you will need, begin 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
Step 3: Create Slack Webhook for each Slack action
See Step 2: Retrieve and apply the Slack Webhook URL for your workspace 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 condition based on the channel associated with the webhook. Open the Conditional Logic dropdown found in the action. This will help you determine which Slack channel you want the notification to 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.
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. Suppose you included the {post:permalink} merge tag to the notification for user-published posts. In that case, you should click on the post to automatically preview what your user has written, as long as you are logged in to your WordPress site.
Bonus: Create Trello Cards from your Slack interface using the blog post URLs
To take your notification workflow to the next level, I recommend adding Trello to your Slack channels. Doing so will allow you to make Trello cards out of your notifications for user-published posts.
To get started, go to Slack Apps > Add Apps and select Trello. Slack will take you through a series of confirmations setting up Trello within your Slack account. If you get stuck, see Trello for Slack.
Link the Trello board to your chosen Slack channel by typing the command /trello link and the URL of the Trello board you would like added. Then type /trello *paste in the review post title and link from your Slack notification * and a card Trello will automatically be added to your list!
Hooray! You never have to check your email again!
Now that you know how to set up Slack notifications for user-published posts send notifications to different channels, and receive real-time updates from your users, I encourage you to give it a try. Guess what? Slack, Font-End Posting, and Conditional Logic come with asked a 14-day money-back guarantee. So, what are you waiting for?