Search code examples
phpmailjet

Mailjet Unsubscribe statistics


Am trying to get mailjet statistics using this code:

require 'vendor/autoload.php';
use \Mailjet\Resources;
$mj = new \Mailjet\Client('xxxxxxxxxxxxxxxxxxxx','xxxxxxxxxxxxxxxx');
$body = [
'EventType' => "unsub",
'Url' => "http://example.com/Eventcallbackurl"];
$response = $mj->post(Resources::$Eventcallbackurl, ['body' => $body]);
$response->success();
var_dump($response->getData()));

so that's code returns the following error:

MJ18 A EventCallbackURL resource with value "5|false" for EventType|Backup already exists.


Solution

  • Well, i may not understand your question as well, but may this help :

    $filters = array('CustomID' => 'the custom id when creating a capmaign');
    $response = $mj->get(Resources::$Messagesentstatistics, array('filters' => $filters))