Webhooks allow you to collect subscribers from your website and have their details sent to a URL specified by you. All you have to do is provide a URL, select what details you want to get from your subscribers, and we’ll send it over to you in real time.
For testing our Webhooks before you setup a bunch of scripts, the RequestBin or the PostCatcher tools can help you with that. Just generate a custom URL inside any of the 2 tools and add it to the PadiAct setup.
Setting up WebHooks
Webhooks can be configured from the campaign settings page in your PadiAct account. Here are the basic steps:
- Login to PadiAct.
- If you have not yet generated a campaign, do so and select WebHooks as a service for sending email subscribers.
- Otherwise, click Edit Settings for any of the existing campaigns.
- Click the Change Provider link under the What details do you want to ask from your subscribers? section.
- Click the WebHooks tab and then click Continue.
Configuration should be pretty straight forward – enter a valid URL for us to send data to, then select the fields you want users to fill in when they subscribe.
Currently we support both HTTP or HTTPS URLs, so you can get some semblance of security by using an SSL-enabled URL.
Keep in mind that your endpoint is going to be wide-open on the Internet and you may not want others to be able to submit random data to your systems. At this time, aside from trying to keep the URL private, the best suggestion we have is for you to simply include a secret key in the URL your provide and check that GET parameter in your scripts.
When an event that you have turned on occurs, we’ll send a HTTP POST request to the URL you’ve specified. If that URL is not available or takes too long to respond, we’ll cancel the request and try again later in the day.
We will try to send it to you 3 times. If all tries go unsuccessful, we will cancel the requests and you will get a notification via email. When the webhook URL will start working again, we will redo the calls. We won’t keep unsent subscriber data on our servers for more than 30 days.
To be clear: below is sample data to show you the fields returned – the POST request actually sends key/value pairs just like a normal HTML Form Submission.
data[email] = email@example.com data[field1] = claudiu data[field2] = New York from=padiact
Here is a PHP example on how to use webhooks to send a notification via email every time somebody subscribes.
Displaying Error Messages to Users
When a user subscribes, her details are sent over to the webhook endpoint. At that moment, PadiAct waits for an answer from your server.
If there are no server errors, the server will send a 200 OK message.
When ans error message is received, PadiAct looks at the content of the reply from the server. If in that content it finds the <error>Error goes here</error> text, it will consider the subscription as unsuccessful and will display that error message to the user without triggering the success screen or redirect.