Skip to content

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

ParameterTypeExampleDescription
componentIdNumber123Pixcraft components ID.
campaignIdNumber124Campaign ID to which the component belongs. 
It can be empty if the component is not tied to any campaign.
emailStringtest@test.comThe email address of the subscriber who has submitted the form.
dateUNIX date1648553051The time when the event occurred.
ownerNumber125The form owner ID in Pixcraft.
dataContent-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
<?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;
}