Woobox now offers a real-time API that you can use to export data from your campaigns on-the-fly to your own server. You can then pass that data along to your own CRM, mailing list, or any other database you like.
Setting it Up
The first step to setting up this API integration is to create a callback URL in your Woobox Business Settings. Just click Integrations, type in the Callback URL, and hit save. Note: this URL can be different for each business page in your account.
What the Callback URL Actually Does
Anytime someone enters one of your promotions, our server will send a JSON array to your callback URL for parsing. This array will contain a variable "shard", which indicates the campaign it came from, along with a variable for each form field in your campaign. Examples could be "email", "custom_0", or "custom_1" if using our default form.
If your campaign is receiving a lot of entries, we will send over an array of entries as a batch under the key "entries".
Your server will need to listen for this JSON array, and parse it into a local variable using a server-side language like PHP, Python, or Ruby. From there, you can save it to your database or push it out to any other API of your choosing.
The first time you set up the callback URL, our system will need to verify that you can actually receive data at that URL. To do this, we send an initial POST to that URL containing a unique identifying code: realtimeapi_code as arbitrary chars using enctype "multipart/form-data".
Your script will need to record that code into a log file (or anywhere you can view it). Then, you'll need to set your headers from that page to include the code. Example in PHP:
file_put_contents('/tmp/data.txt', $_POST, FILE_APPEND | LOCK_EX);
As long as our server continues to receive that header on hitting your script, it will send the data over.
The only remaining steps are to enter a campaign to receive the JSON array at your script, and record that data somewhere. Note: For any campaign to send out data via our API, you will need to go to the "Export - Realtime Exports" section of your campaign dashboard and change Webhook to On.
For reference: The JSON array we send over is a post variable named "entries" using enctype "multipart/form-data".