Collection of scripts to allow interactions with Emailbidding API

v1.2 2017-09-14 17:13 UTC


This SDK serves to help Emailbiddings's publishers to integrate their systems with Emailbidding platform.


You'll need to be install on your server the PHP 5.4 version or higher and add the package 'wondeotec/emailbidding-sdk' to you composer dependencies.


If you are an Emailbidding publisher, then you can subscribe an endpoint and listen Emailbidding's events such as unsubscriptions, soft bounces, hard bounces, clicks or even opens.

This SDK helps you on testing your test to be able to receive an webhook event. Emailbidding system always send an HTTP POST request to the given endpoint with an JSON object on body identical to the following:

  "trigger_date":"2015-09-03 11:13:34",

This SDK provides you an object to send webhooks to your endpoint in the same way as the Emailbidding system will send to you on the production environment.

The object 'EB\SDK\Webhook\Webhook' has a single method that accepts a payload and and endpoint. You can create an object of type 'EB\SDK\Webhook\Payload', or you just can 'ask' to 'EB\SDK\Webhook\Payload' to create an simple object to you. See the following example:


use EB\SDK\Webhook\PayloadFactory;
use EB\SDK\Webhook\Webhook;

$webhook = new Webhook();
$success = $webhook->post(
    PayloadFactory::createOpen('email@domain.com', 'my_list'),

Recipient subscribe

Emailbidding recipient subscribe API allow you to upload your database to Emailbidding platform. You have to distinct methods to submit your recipients: simple and anonymous integration. This SDK helps you on the integration providing you an 'EB\SDK\RecipientSubscribe\RecipientSubscribe' object that you can instantiate with 'EB\SDK\RecipientSubscribe\Recipient' objects and then you just need to post the recipients data to Emailbidding. Take the following example in consideration:

use EB\SDK\RecipientSubscribe\RecipientSubscribe;
use EB\SDK\RecipientSubscribe\RecipientFactory;

// Creating a recipient subscribe object with my credentials
$recipientSubscribe = new RecipientSubscribe('YOUR_PUBLISHER_API_KEY', 'YOUR_PUBLISHER_API_SECRET');

// Posting an simple recipient (minimal information) to Emailbidding API and dumping the result
    array(RecipientFactory::createSimpleRecipient('email@domain.com', 'FR')),

// Posting an anonymous recipient to Emailbidding (NOTE: the email address WILL NOT be sent to Emailbidding)
// The email address 'email@domain.com' will be transformed in '7328fddefd53de471baeb6e2b764f78a'
    array(RecipientFactory::createSimpleAnonymousRecipient('email@domain.com', 'FR')),

Server to Server Submission

Emailbidding SDK allows you, as an advertiser, to submit your conversion to Emailbidding platform. In order to use this API you need to grab you advertiser EB API key and secret.

The Emailbidding S2S API accepts an HTTP POST with the following JSON as payload:

    "description":"Test conversion",

Below, you will find a snippet of PHP code that show you how to send conversion data using Emailbidding conversion API.



// Set your credentials
$apiKey       = 'YOUR_API_KEY';
$apiSecret    = 'YOUR_API_SECRET';
$advertiserId = 'YOUR_ADVERTISER_ID';

// Set your conversion details
$conversionDetails = new Details(1.23, new \DateTime(), 1);
$conversion        = new Conversion('123456', 'Test conversion', $conversionDetails);

// Submit your conversion
$conversionSubmit  = new ConversionSubmit($advertiserId, $apiKey, $apiSecret);

For more examples you can clone the following project from github: https://github.com/wondeotec/sample-emailbidding-sdk