Incoming API Webhooks Guide

OptimizeMentor includes an Incoming API which means you perform functions on your OptimizeMentor site via webhooks sent from external sources. 

External sources could be other platforms that can send data as webhook (provided it is formatted correctly) or the more likely use is sending data into OptimizeMentor from platforms such as Zapier, Make, Pabbly or other integration services.

You can perform functions such as:

  • Adding a member to your site
  • Adding a specific membership or memberships to your new member
  • Removing a membership from a member of your site

Get Your OptimizeMentor API Details

Before you start using the incoming API, you will need to grab a couple of details from your OptimizeMentor site. Head to Mentor > Settings > API settings to get the following important details for setting up your webhooks

Base URL & API Key

You will need your base URL and API key in order to create any webhook urls for interacting with your site via the incoming API.  You can find these details on the API settings screen inside OptimizeMentor Settings:

Your base URL tells the external platform where to send the data to. You will find it inside the API Settings inside OptimizeMentor and it should look something like:

https://yourdomain.com/wp-json/opm-api/v1

Your API Key is used to authenticate the communication between your external platform and your OptimizeMentor site. This stops anyone else sending data into your site without your permission and keeps things secure.

You can click the copy icon next to the API to copy this to your computers clipboard when you need it.

Creating Webhooks to send data into your OptimizeMentor site

In order to create, update or delete a member on your OptimizeMentor site, you will need to use a specific webhook URL.  In this section we’ll explain these different commands and provide examples for you to use.

Create new member

To create a new member on your website using data from an external source, you need to create a webhook using the POST request type:

Use the following URL structure (explained below):

http://YOUR-BASE-URL/members?memberships=1,2,3&opm_api_key=YOUR_API_KEY

Here’s how to use and modify this URL webhook:

  • http://YOUR-BASE-URL/ – Replace this with your base URL (e.g. https://yourdomain.com/wp-json/opm-api/v1)
  • /members? – this part tells our system you are adding a member to the site
  • memberships=1,2,3 – replace this with the ID of the memberships you want to add to this new member.  Each new membership should be separated with a comma
  • &opm_api_key=YOUR_API_KEY – replace “YOUR_API_KEY” with the api key you copied in the steps above to authenticate your request

If you also want to notify the new member of their logins, you will need to add the following:

  • notify=1

A complete webhook to add a member, add memberships 1,2 and 3 and notify the user via email of their logins would look like this:

http://YOUR-BASE-URL/members?memberships=1,2,3&opm_api_key=YOUR_API_KEY&notify=1

Assign membership to member – by email

Create a webhook with a POST request type and enter the following URL:

http://YOUR-BASE-URL/members/add-membership?membership_id=3&opm_api_key=YOUR_API_KEY

Remove membership from member – by email

Create a webhook with a POST request type and enter the following URL:

http://YOUR-BASE-URL/members/remove-membership?membership_id=3&opm_api_key=YOUR_API_KEY

Variables available for all Webhooks

There are a number of variables available for use within Webhooks. You must provide an email address value in order for the webhook to work.  Other values are optional.  If no memberships are provided, member will be added with no memberships assigned.

  • email
    • type: string
    • required: Yes
  • first_name
    • type: string
    • required: No
  • last_name
    • type: string
    • required: No
  • notify 0/1
    • type: bool
    • required: no
    • default: false
  • memberships
    • type: array/string
    • required: no

Frequently Asked Questions

Where can I find the Membership ID?
The Membership ID is found under “Mentor > Memberships” under the name of each membership like you see in the below image.

Updated on June 7, 2023

Was this article helpful?

Related Articles

Need Support?
Can't find the answer you're looking for? Don't worry we're here to help!
Contact Support