1

I am new to Exact Target API and I am using the FuelSDK for PHP. I already have my data extension (created using TriggeredSendDataExtension template) with an email field that is linked to all subscribers' emails. My data extension's primary key is "My_ID" which are populated with unique strings.

This is my code:

 $sendTrigger = new ET_TriggeredSend();
 $sendTrigger->props = array('CustomerKey' => 'My_Trigger');
 $sendTrigger->authStub = $this->myclient;
 $sendTrigger->subscribers = array(array("EmailAddress" => "customer@email.com", "SubscriberKey" => "customer@email.com", "My_ID" => "someUniqueString"));
 $response = $sendTrigger->send();

But I always get this error response:

[ErrorCode] => TriggeredSendSubscriberProcessingError 
[ErrorDescription] => Error Code: 19 - No value was provided for required data extension field My_ID. 

Can anyone please enlighten me?

  • This should not be closed; this is also an Exact Target stackexchange site. – Timothy Aug 6 '14 at 19:47
1

MY_ID should be in the Subscribers.Attribute array, not on the Subscribers array itself.

Take a look ET's example on the Send TriggeredSend Email page:

I find the SOAP envelopes most helpful. It's at the bottom.

0

95% of time this error occurs, is because the API is not passing a value for the two default and required fields, email address and subscriber key. got those in there?

  • Yes, they are in there. I even tried sending an empty array just to see the difference in the response messages. Not having the email address or subscriber key results to two different error messages. When both are present im stuck with my current issue. – user10861 Aug 6 '14 at 19:28
  • Have you tried the Subscriber Retrieve Command? (link: help.exacttarget.com/en-US/technical_library/xml_api/…) – Eduardo Arias Aug 6 '14 at 19:48
  • I'd stay away from the XML API. It's deprecated and does not work in Enterprise 2.0 accounts. – Adam Spriggs Aug 21 '14 at 18:10
0

EX props (for Ruby, I'm not a PHP dev):

sendTrig.props = [{
"CustomerKey" => "TRIGGERED_EMAIL_NAME", 
"Subscribers" => {
    "EmailAddress"=>"example@email.com", 
    "SubscriberKey" => "example@email.com", 
    "Attributes" => [{
            "Name"=>"EMAIL_ADDRESS", 
            "Value"=> "example@email.com"
            }]
    }
}]

EmailAddress, SubscriberKey, and EMAIL_ADDRESS all need to be set and have the same value for the email to be sent.

0

Since this is a php exacttarget question I'll post the code which worked for me (note: my composer file included the "salesforce-mc/fuel-sdk-php": "1.3.0" and I copied the config.php.template from vendor/saleforce-mc/fuel-sdk-php/config.php.template to my current directory):

<?php
require __DIR__ . '/vendor/autoload.php';
require 'config.php';

use FuelSdk\ET_Client;
use FuelSdk\ET_TriggeredSend;

try {
    $myclient = new ET_Client();

    //Triggered Send Testing
    // Specify the name of a TriggeredSend that was setup for testing
    // Do not use a production Triggered Send Definition

    // Send an email with TriggeredSend
    print_r("Send an email using a triggered send \n");
    $sendTrigger = new ET_TriggeredSend();
    $sendTrigger->props = array('CustomerKey' => 'NAME_OF_MY_TRIGGERED_SEND');
    $sendTrigger->authStub = $myclient;
    $sendTrigger->subscribers = array(array(
        'EmailAddress' => 'email1@gmail.com',
        'SubscriberKey' => 'email1@gmail.com',
        'Attributes' => array(
            array('Name' => 'CUSTOM_SUBJECT', 'Value' => 'Custom Email Subject 101'),
            array('Name' => 'CUSTOM_LINK', 'Value' => 'https://google.com/test1'),
            array('Name' => 'PATIENT_NAME', 'Value' => 'John SmithUser1)
        )
    ),array(
        'EmailAddress' => 'email2@hotmail.com',
        'SubscriberKey' => 'email2@hotmail.com',
        'Attributes' => array(
            array('Name' => 'CUSTOM_SUBJECT', 'Value' => 'Custom Email Subject 102'),
            array('Name' => 'CUSTOM_LINK', 'Value' => 'https://google.com/test2'),
            array('Name' => 'PATIENT_NAME', 'Value' => 'John SmithUser2')
        )
    ));
    //https://developer.salesforce.com/docs/atlas.en-us.mc-sdks.meta/mc-sdks/triggered-send-send.htm
    $sendResult = $sendTrigger->send();
    print_r('Send Status: '.($sendResult->status ? 'true' : 'false')."\n");
    print 'Code: '.$sendResult->code."\n";
    print 'Message: '.$sendResult->message."\n";
    print 'Results: '."\n";
    print_r($sendResult->results);
    print "\n---------------\n";

} catch (Exception $e) {
    echo 'Caught exception: ',  $e->getMessage(), "\n";
}
?>

Here is an example config.php file. Make sure you get those clientid/secret/url values from ExactTarget's/Salesforce MarketCloud's 'Installed Packages' page:

<?php
return array(
    'appsignature' => 'none',
    'clientid' => 'GET_FROM_ET',
    'clientsecret' => 'GET_FROM_ET',
    'defaultwsdl' => 'https://webservice.exacttarget.com/etframework.wsdl',
    'xmlloc' => __DIR__ . '/wsdl/etframework.wsdl.xml',
    'baseUrl' => 'https://www.exacttargetapis.com',
    'baseAuthUrl' => 'https://GET_FROM_ET.com',
    'baseSoapUrl' => 'https://GET_FROM_ET.com',
    'useOAuth2Authentication' => true,
);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.