You’ve chosen to use the bbpnns Reply by Email Webhook instead of the WordPress Cron system. Smart choice. Now, every time the Webhook is called, the plugin will check your inbox for the newest replies to be added to your bbpress forums.
[vinyl scratching] Wait, what’s a webhook?
Webhook is nothing but a fancy name for an action taken by a site when a given URL is accessed. In the plugin settings you were given a web address to use.
The trick now is getting that webhook called as frequently as possible without enraging your web host.
Keep reading to learn about our recommended methods of setting up the Webhook calls.
IFTTT
IMPORTANT: On March 30, 2019, Gmail changed their API and IFTTT can no longer offer its service. We’re sorry, but it is not within our control. Please refer to the Zapier or Real Cron Jobs steps instead.
Zapier
Zapier is another service like IFTTT, where you get to create “Zaps”. Like IFTTT, you can connect to service providers and create triggers. Unlike IFTTT, it lets you connect to IMAP so you can use it for free Outlook/Hotmail accounts and even your hosting provider’s email service if you’re using that. The downside of using Zapier is that it only checks your mailbox in 15 minute intervals instead of every minute, so your forum participants are likely to think something went wrong and re-send the replies over and over. Each email reply will be translated into a forum reply, even if it’s a duplicate.
IMPORTANT: The bbpnns Reply by Email plugin requires an email server that supports “plus aliases”, i.e. sending messages to foo+bar@domain.com is the same as delivering to foo@domain.com. To our knowledge, the only large hosting providers that currently support this are Gmail and Outlook/Hotmail. The plugin will NOT work without it. Only go the IMAP route if you tested “plus alias” support manually or via the plugin settings screen. You’ve been warned :). Continuing…
To set up a Zap to trigger the webhook, follow these steps:
- Create a free zapier account if you don’t have one;
- Search for IMAP by Zapier app and select it;
- Search for Webhooks by Zapier app and select it;
- Click the ‘Use this Zap’ button in the box that says ‘Create Webhook post from new IMAP emails’.
- Follow the instructions to create the Zap. When prompted to connect an IMAP account, use the IMAP settings that your hosting provider gave you;
- Click Save+Continue;
- Select Inbox when prompted to select an IMAP folder. Click Continue;
- Click Fetch+Continue to test the connection;
- If the test is successful, click Continue to set up the Webhook;
- The only option now is to “Fire off a single POST request as a form or JSON”. Click Continue;
- Enter the Webhook URL you were given in the bbpnns Reply by Email plugin’s settings screen in the Zapier URL field. Click Contiue;
- Click Send Test to Webhooks by Zapier. Don’t worry if it says that the test was successful but no data was available. That’s intentional.
- Finally, click finish.
Zapier will check the mailbox for new messages every 15 minutes and call our plugin to do the processing.
Real Cron Jobs
The Cron system was designed to let people run programs at given dates/times or intervals (called jobs). It is essential in any Unix or Linux environment, and all decent hosts will let you create new jobs.
WordPress tried its best to create a faux Cron system for those who can’t or don’t want to deal with real Cron systems. However, because it needs to keep its performance good, it can’t simply run indefinitely in the background waiting for whatever date/time there are jobs to run. It only runs when someone visits your site, so even if you have a job that was set to run at, say, noon every day, and your site only receives a visitor at 5PM, that’s when the noon job will run.
You can (and, for bbpnns Reply by Email to work effectively, should) replace the Cron functionality that’s bundled with WordPress with a real Cron job. It’s quite simple and jsut requires editing wp-config.php to disable the internal WP Cron before running your own.
There are several tutorials available on how to do that. I like the one at SiteGround.
Feel free to follow that tutorial to the letter if you want to (to replace WP Cron), especially if you chose to not use the Webhook.
To get bbpnns Reply by Email to work as a Webhook, you’ll need to add the Webhook command that you got in the Settings screen as a new job in the Cron Job screen in cPanel – you don’t need to replace WP Cron at all.
Set it to run as frequently as possible without enraging your hosting provider. SiteGround asks that you don’t run any jobs in intervals smaller than 30 minutes. This is obviously not frequently enough for any good user experience (where’s my email reply? should I send it again?), which is why using Cron Jobs is last on our list.
Conclusion
This concludes our tutorial on how to set up bbpnns Reply by Email to work with Webhooks. We strongly believe that setting up IFTTT with Gmail is the best option to get the smoothest email to reply user experience.
If you still don’t have the bbpnns Reply by Email plugin,