1. Home
  2. Knowledge Base
  3. OptimizePress
  4. Integrations
  5. Webhook Integration (for opt-in forms)

Webhook Integration (for opt-in forms)

OptimizePress version 3 has a way to send Webhooks when a site visitor fills in an optin form. This will allow you to send data about the contact to any 3rd party service that will accept a webhook. 

This integration is available while creating the optin form. Just go into Integration Options and you’ll be able to choose that from the integrations: 

After selecting Webhook integration, click the green “Next Step” button and enter the URL for where you want to send your data (note this must be a valid webhook URL). 

After entering your webhook URL, click the green “Next Step” button again and you’ll be able to choose the form fields that you want to use. Note that currently custom fields are not supported, but may be added in a future update.

You’ll notice that some fields may be outlined with a blue border. Those indicate that those fields are already selected by default. Any field you select to add will also have a blue outline to indicate that it is turned on for this optin form. 

Fields starting with “GDPR” are designed to be used alongside the “GDPR” feature of the optin form. You may check our guide here on how to use the GDPR section:
https://docs.optimizepress.com/article/2098-how-to-use-the-gdpr-features-within-opt-in-form-elements

Also, we recommend checking our guide for optin forms as a primer to using other features of the optin form element: 

https://docs.optimizepress.com/article/2097-how-to-use-the-opt-in-form-element


Webhook Integration Parameters

Each field sends a parameter to your webhook URL and can be used within the app that you send the data to. To help save you some time, below is a list of the parameters that we send through: 

email

first_name

last_name

We also send the GDPR parameters that are needed, but not all of them on each webhook as it depends on what is selected in the form: 

gdpr_confirmed

gdpr_declined

gdpr_confirmed_2

gdpr_declined_2

gdpr_note
The GDPR confirm/decline fields are only sent if there is a “yes” response
If box is not checked it will come through as declined with “yes”
GDPR note is going to include the button text and consent text for the GDPR which is required to be kept if you are under GDPR regulations.

If you would like to run some tests to see how it works, you may use a currently free service over at
https://webhook.site/ which will give you a URL that you can send webhook data to, and it will show you result like this: 

{

“email”: “email@nobodyheretoday.com”,

“first_name”: “John”,

“last_name”: “Smith”,

“gdpr_note”: “Button Text: Get Instant Access Now | Consent 1 Text: GDPR Consent 1 Message | Consent 2 Text: GDPR Consent 2 Message”,

“gdpr_confirmed”: “yes”,

“gdpr_confirmed_2”: “yes”

}
This guide is not designed as a course to show you how webhooks in general work. You should already have an understanding of webhooks before trying to set this up. our team are not able to assist with setting up a custom script to use the webhooks integration and can not modify codes or scripts as part of our support. With the help of the webhook.site link above and a competent developer or help from a 3rd party app’s support team, you should be able to use this integration. 
If you are not sure how to do this, the next best thing we have for you to use is the
Zapier Integration which can also send data to other 3rd party apps. 
If you have any questions about what is covered in this guide please reach out to our support team for further help.


Frequently Asked Questions

Q: Can I use custom fields with the Webhook integration?
A: Currently at the time this article was published in March 2020 the optin form element does not support custom fields. 

Q: Can I use hidden fields with the Webhook integration?
A: Hidden fields are not supported at the time this article was published in March 2020, but we are considering to add this.

Q: What PHP code do I need to create a custom app on my website where I can fully control every aspect of the data when I send it to a URL with the script?
A: Unfortunately we are not able to assist with custom codes or scripts as that is beyond the scope of the support our team can help with. We would suggest reaching out to a competent developer to help you. Our integration is designed to work with 3rd party apps that already have a URL they provide to you to send the data to. It would be best to reach out to them for support. If you created your own app and need help, we are limited to providing help for the items discussed in this guide and can not help or assist in any way with custom development work. 

Q: What is a webhook anyways?
A: Webhooks are strings of data that get sent between apps in the form of a URL, JSON code, cURL or other kinds of coding languages (basically email for apps if you want to think about it that way). It allows you to take data which was input (or already existing) on one app or site and send it to another app or website and then trigger something with the data (depending on what you are sending the data to). Most integrations on the internet between apps will use a form of webhooks whether that be through an API or OAuth. Without webhooks, or the ability to communicate data between apps, the internet would really be a useless tool only suitable for playing Angry Birds or maybe creating websites with HTML that wouldn’t even be able to collect the date or IP from a visitor. Webhooks are the “glue” that binds things together. Without it, Internet marketing would be very different from what it is today. 

Updated on November 28, 2022

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