0

I am trying to send SMS from php, for some strange reason I have started getting this error.

Single sends must include a subscriber

Whereas I am providing the subscriber with the send definition.

try {
        /* Create the Soap Client */
        $client = new ExactTargetSoapClient($wsdl, array('trace'=>1));

        /* Set username and password here */
        $client->username = 'userName';
        $client->password = 'Password';

        $tsd = new ExactTarget_SMSTriggeredSendDefinition();

        $tsd->Name = "ABCDE";
        $tsd->CustomerKey = "xxxxx"; // set external key/unique identifier for the triggered send definition
        $tsd->SendToList = false;
        $tsd->SendToListSpecified = false;
$ts = new ExactTarget_SMSTriggeredSend();

        $ts->SMSTriggeredSendDefinition = new SoapVar($tsd, SOAP_ENC_OBJECT, 'SMSTriggeredSendDefinition', "http://exacttarget.com/wsdl/partnerAPI");
        $subscriber = new ExactTarget_Subscriber();
        $subscriber->SubscriberKey = "validEmail";


        $ts->Subscriber = $subscriber;

        $ts->Number="90909090909";
        $ts->Message="Hello from me";   

// create SoapVar object
        $object = new SoapVar($ts, SOAP_ENC_OBJECT, 'SMSTriggeredSend', "http://exacttarget.com/wsdl/partnerAPI");

        // create request object
        $request = new ExactTarget_CreateRequest();
        $request->Options = NULL;
        $request->Objects = array($object);

        // Create the triggered send definition
        $results = $client->Create($request);

Result

["StatusCode"]=>
    string(5) "Error"
    ["StatusMessage"]=>
    string(39) "Single sends must include a subscriber."
    ["OrdinalID"]=>
    int(0)
    ["ErrorCode"]=>
    int(33100)
    ["NewID"]=>
    int(0)

Any help please ?

1

I dont have a PHP example handy, but I don't see where $subscriber is associated with the request object. That would likely be the root cause of the error.

With other SDK languages, you generally create a subscriber object, assign its attributes (sub key, mobile number), then assign that subscriber object to the triggered send object prior to performing the InvokeCreate.

An example from .NET:

SMSTriggeredSend ts = new SMSTriggeredSend();
... 
SMSTriggeredSend ts = new SMSTriggeredSend();
ts.Number = "1-123-456-7890";
ts.Message = "TEST SMS";

SMSTriggeredSendDefinition tssd= new SMSTriggeredSendDefinition();
tssd.CustomerKey = "12345";

ts.SMSTriggeredSendDefinition = tssd;

Subscriber sub = new Subscriber();
sub.SubscriberKey = "1-123-456-7890";//The Subscriber Key of a record on the All     SMS Subscribers List

ts.Subscriber = sub;

Specifically referring to the very last line here, where the subscriber object called 'sub' is set to the subscriber property of ts.

  • Thanks David for looking and replying, Yes you are right, Sorry I missed to paste $ts->Subscriber = $subscriber; line here but in my original code it is present. – Fayyaz A Mian Apr 19 '16 at 8:13
  • Even I am getting subscriber details from ET with in response message ["Subscriber"]=> object(stdClass)#8 (4) { ["PartnerKey"]=> NULL ["ObjectID"]=> NULL ["EmailAddress"]=> string(26) "xxxxxxxxx" ["SubscriberKey"]=> string(18) "xxxxxxxxx" } – Fayyaz A Mian Apr 19 '16 at 8:44

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.