Trigger smart transactional email in campaign monitor from Wordpress

562 Views Asked by At

I am trying to trigger the send of a smart transactional email in Campaign Monitor from my Wordpress app

require_once( get_stylesheet_directory() . '/createsend-php-master/csrest_transactional_smartemail.php' );

# Authenticate with your API key
$auth = array('api_key' => 'apikey');

# The unique identifier for this smart email
$smart_email_id = 'emailid';

# Create a new mailer and define your message
$wrap = new CS_REST_Transactional_SmartEmail($smart_email_id, $auth);
$message = array(
    "To" => '[email protected]',
    "Data" => array(
        'x-apple-data-detectors' => 'x-apple-data-detectorsTestValue',
        'href^="tel"' => 'href^="tel"TestValue',
        'href^="sms"' => 'href^="sms"TestValue',
        'owa' => 'owaTestValue',
    ),
);

# Send the message and save the response
$result = $wrap->send($message);

I've got the correct API and Email ID, and I'm using my gmail account to test with but the email just isn't getting triggered. I'm a beginner coder and I reckon I've just missed something completely obvious!

Path to the campaign monitor php file is correct too.

The API documentation is here https://www.campaignmonitor.com/api/transactional/?_ga=1.180877863.1694927084.1483423346 - is there anything I've missed out. Help is much appreciated!

0

There are 0 best solutions below