Configuring the bbpnns Reply by Email Webhook

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

Wait, what’s a webhook?

A 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. Here are a couple of solutions that we recommend.

  1. Real Cron Jobs
  2. Zapier

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 possibly allowed by your hosting provider. If the host prohibits you from running it frequently, then try out the free Cron-job.org service. It’s easy to set up and you get to set frequencies as low as every minute.

Zapier

Zapier is an online automation tool that connects your favorite apps, such as Gmail, Slack, Mailchimp, and more. 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.

To set up a Zap to trigger the webhook, follow these steps:

  1. Create a free zapier account if you don’t have one;
  2. Search for IMAP by Zapier app and select it;
  3. Search for Webhooks by Zapier app and select it;
  4. Click the ‘Use this Zap’ button in the box that says ‘Create Webhook post from new IMAP emails’.
  5. Follow the instructions to create the Zap. When prompted to connect an IMAP account, use the IMAP settings that your hosting provider gave you;
  6. Click Save+Continue;
  7. Select Inbox when prompted to select an IMAP folder. Click Continue;
  8. Click Fetch+Continue to test the connection;
  9. If the test is successful, click Continue to set up the Webhook;
  10. The only option now is to “Fire off a single POST request as a form or JSON”. Click Continue;
  11. Enter the Webhook URL you were given in the bbpnns Reply by Email plugin’s settings screen in the Zapier URL field. Click Contiue;
  12. 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.
  13. Finally, click finish.

Zapier will now check the mailbox for new messages every 15 minutes and call our plugin to do the processing.

Conclusion

IFTTT stands for If This Then That, and is a free service which lets you connect services according to pre-defined rules, called Applets (they used to be called recipes). You can create your own applets or use any of the many available applets built by IFTTT, service providers, or users like yourself.IFTTT connects seamlessly with Gmail (and Google Apps, which essentially the same thing), and Office 365 (for paid outlook accounts) but currently does not support checking POP3/IMAP mailboxes. If you need POP3/IMAP direct checks, skip ahead to the Zapier and Real Cron Jobs sections below.

For the purpose of this tutorial, we’ll assume you’re using Gmail. Setting up Outlook 365 (if you have the paid service) should be pretty much the same (we haven’t done it ourselves, to be honest, as we don’t have the paid service).

Here’s what you need to do to get bbpnns Reply by Email running with IFTTT:

  1. Create a free IFTTT account just to use with this plugin, if you don’t already have one. Simply go to https://ifttt.com and follow the signup steps. You can also choose to connect with your Google or Facebook account.
  2. Once your account is set up, go to the Gmail service page: https://ifttt.com/gmail (or https://ifttt.com/office_365_mail if you’re setting up your paid Outlook account).
  3. You can only have one connected Gmail account per IFTTT account, so if you already have Gmail connected with your existing IFTTT account, disconnect it *. Then click the big Connect button.This will take you to the Gmail OAuth screen, where you’ll need to log in with the Gmail account you set up in your bbpnns Reply by Email settings screen, and click  ‘Allow’ when prompted.
  4. That’s it for Gmail. Now we need to tell IFTTT that we want to use Webhooks. Go to https://ifttt.com/maker_webhooks and Click connect, just like you did for Gmail.You will not get any Oauth screens or anything. Just the Webhooks screen without the connect button.
  5. Finally, set up your Applet to call our Webhook when new messages arrive. IFTTT seems to check Gmail every minute, so this is by far the best solution you can get. Click My Applets > Create, or go directly to https://ifttt.com/create. You’ll see the new applet screen:
    Click on the big blue “+ this” link (yes, it’s a link – I was a bit lost way back when I first tried it).
  6. Enter Gmail in the “Choose a Service” screen, and click the Gmail icon.
  7. In the Trigger screen that comes up, select the box that says ‘Any new email in inbox’. You’ll be taken back to the New Applet screen with the ‘+ that’ now linked and the Gmail icon replacing the ‘+ this’. Click ‘+ that’ and type Webhooks. Click the Webhooks icon.
  8. Click the ‘Make a web request’ action box (the only one available at the time we wrote this tutorial).
  9. Enter the bbpnns Reply by Email Webhook URL you were given in the plugin’s settings screen in the URL field. Leave the other fields as they are, as they are not important. Finally, click the ‘Create Action’ button at the bottom of the box.
  10. You’re almost there! You can now choose to change the description of your action and whether to receive notifications when the applet runs. Just click ‘Finish’ to complete the applet creation.

Once your applet is created, you can turn it off or on, and also force check the Gmail account.

* You can take a more complicated approach and share a gmail account by setting up labels for messages that contain +usc_ as the beginning of the “to” field, and have the Gmail trigger run when a message gets labeled, but that’s beyond the scope of this tutorial.

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 add-on,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.