2

I have a web form that adds subscribers to a list via the API but because i'm using the API rather than web collect it won't send out the welcome email. How would I send send the welcome email via api? I've found examples on how to create a new Trigger email and add a list to it as well as how to trigger it but I want to send one email to one specific email(the new sub that was just added).

The workflow of my code is like this;

enter email in form-> submit form -> PHP script adds email to list-> success

I would like it to do this

enter email in form-> submit form -> PHP script adds email to list-> success -> send welcome email to new sub.

Is there a simple way to do this?

4

I would set up a new Triggered Send definition in the account and then call it manually using either the SOAP or REST API's. Populate the Triggered Send request with the info of the new subscriber you just successfully added. There are a couple ways to do this with ET's APIs.

SOAP http://help.exacttarget.com/en-US/technical_library/web_service_guide/technical_articles/send_triggeredsend_email/

REST https://code.exacttarget.com/api/messaging-messagedefinitionsends-send

Fuel SDK You can also send a triggered email in PHP with the FuelSDK. The Fuel SDK is an abstraction layer on top of the API's listed above. https://code.exacttarget.com/sdks/fuel-sdk-interacting-triggeredsend

  • when you say "set up a new Triggered Send definition" do you mean using the API or through the GUI and then referencing it in the API by its CustomerKey(External Key) ? – swgamerx150 May 29 '14 at 16:20
  • I think he means GUI. Its a lot easier. Two common issues if you go this route (and I recommend you do): 1. Make sure you can send the email without the Trigger. It needs to pass validation. 2. Start the triggered send under interactions. – Timothy May 29 '14 at 16:21
  • Timothy, thats what I think he means as well. Any idea if I need the Lead information and EmailHash that is shown in that example? – swgamerx150 May 29 '14 at 16:23
  • swgamerx150, the lead info and email hash are meant to be example attributes. You would replace those with the attributes you have set up in your own account. Also you are correct, I suggest configuring the email and triggered send definition in the account first, then using the API to add subscribers and send emails. Its just easier to configure everything through the GUI. – Jon Sakas May 29 '14 at 17:02
  • jsakas, Ok it looks like I almost have it working save for one issue. My php file first adds a new subscriber to the list and then after that it triggers the email but the trigger send is erroring saying that no one is in the list. In the GUI i've targeted the list and in the php I specify the email that it should go to $sub = new ExactTarget_Subscriber(); $sub->EmailAddress = $iEmailAddress; $ts->Subscribers = array(); $ts->Subscribers = $sub; – swgamerx150 May 29 '14 at 17:58
0

This I what I'm using in FuelSDK:

try {

   $myclient = new \ET_Client();
   $triggeredsend = new \ET_TriggeredSend();
   $triggeredsend->authStub = $myclient;
   $triggeredsend->props = array("CustomerKey" => "SomeKeyYouSet");
   $triggeredsend->subscribers = array(
    array(
      "EmailAddress"=>"barney@example.net",
      "SubscriberKey" => "barney@example.net",
      // "Attributes" => array(
      //       array('Name' => 'FirstName', 'Value' => 'Bob'),
      //       array('Name' => 'LastName', 'Value' => 'Smith')
      // )
    )
   );
   $results = $triggeredsend->send();

} catch (SoapFault $e) {
    var_dump($e);
}

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.