Webhooks
When a user fills out and submits an AMP form in the email, the data is sent to Pixcraft. However, you can also set up a webhook to pass the data to an external database.
Webhooks are automatic messages sent from one application to another when a certain event occurs. They typically have a payload and are sent to a URL specified in the component settings.
To specify such a URL, go to the form settings in Pixcraft: Components > Choose a Component > Integration tab.
In the Webhook URL field, you need to enter the URL to which the data will be sent.
For example
https://mysite.com/webhook.php
After the user fills out and submits the form, the form data will be sent to https://mysite.com/webhook.php as a POST request with the parameters described below.
Show this table to your developer to prepare functions for processing and saving the data.
You may provide a specific parameters table or details for your developer.
Parameter | Type | Example | Description |
---|---|---|---|
componentId | Number | 123 | Pixcraft components ID. |
campaignId | Number | 124 | Campaign ID to which the component belongs. It can be empty if the component is not tied to any campaign. |
String | test@test.com | The email address of the subscriber who has submitted the form. | |
date | UNIX date | 1648553051 | The time when the event occurred. |
owner | Number | 125 | The form owner ID in Pixcraft. |
data | Content-Type: application/x-www-form-urlencoded | { "field0": "testInput", "field1": "radio1", "field2": "checkbox2", "success": "success" } | The form data. |
An example of a PHP script for data processing:
<?php
$componentId = get_val('componentId');
$campaignId = get_val('campaignId');
$email = get_val('email');
$date = get_val('date');
$owner = get_val('owner');
$data = get_val('data');
function get_val($key){
return (isset($_REQUEST[$key]))?$_REQUEST[$key]:false;
}