I have a page for subscribers.
The intent is to have new subscribers inserted into a DE and have a triggered send to send a welcome mail. But on the other hand, if someone is already a subscriber we recognize his with lookuprows and send him a "we know you" triggered send email.
I keep getting errors:
- 18000 - Triggered Send Object not found
- 18002
- Triggered Send Definition ID/Customer Key don't match (misspelled in code)
- Triggered Send must be in an Active or Inactive status
- No Triggered Send Definition ID or External key supplied
- Triggered Send Definition ID is invalid
- The Triggered Send Object must contain the Triggered Send ID or the Customer Key
- The TriggeredSendDefinitionID provided is not valid for this account
- Invalid Customer Key
- The Triggered Send Definition is not completely configured or in a new status) ,
- 180008 - There are no valid subscribers
%%[
IF @RowCount == 0 THEN
SET @extkey = "11111"
ELSEIF @rowCount == 1 AND @OptIn == true AND (@Topic1 == true OR @Topic2 == true OR @Topic3 == true OR @Topic4 == true) THEN
SET @extkey = "11112"
ENDIF
]%%
%%[
SET @ts_email = RequestParameter("EmailAddress")
SET @FirstName = RequestParameter("FirstName")
SET @LastName = RequestParameter("LastName")
SET @OptIn = RequestParameter("OptIn")
SET @Date = SystemDateToLocalDate(Now(1))
SET @IPNaslov = RequestParameter("IPNaslov")
SET @MC_Unit = "111111111"
/* Trigger Send Object Creation */
SET @ts = CreateObject("TriggeredSend")
SET @ts_def = CreateObject("TriggeredSendDefinition")
SET @ts_subkey = @ts_email
/* Specify the external key of the TriggerSend */
SetObjectProperty(@ts_def, "CustomerKey", @ts_extkey)
SetObjectProperty(@ts, "TriggeredSendDefinition", @ts_def)
/* Create the Subscriber Object */
SET @ts_sub = CreateObject("Subscriber")
SetObjectProperty(@ts_sub, "EmailAddress", @ts_email)
/* Set SubscriberKey to EmailAddress */
IF NOT EMPTY(@ts_subkey) THEN
SetObjectProperty(@ts_sub, "SubscriberKey", @ts_subkey)
ELSE
SetObjectProperty(@ts_sub, "SubscriberKey", @ts_email)
ENDIF
/* Fills out the Business unit involved in TriggerSend data extension */
SET @ts_bunit = CreateObject("Attribute")
SetObjectProperty(@ts_bunit, "Name", "ChannelMemberID")
SetObjectProperty(@ts_bunit, "Value", @MC_Unit)
AddObjectArrayItem(@ts_sub, "Attributes", @ts_bunit)
/* Fill out the FirstName field in the TriggerSend data extension */
SET @ts_fname = CreateObject("Attribute")
SetObjectProperty(@ts_fname, "Name", "FirstName")
SetObjectProperty(@ts_fname,"Value", @FirstName)
AddObjectArrayItem(@ts, "Attributes", @ts_fname)
/* Fill out the LastName field in the TriggerSend data extension */
SET @ts_lname = CreateObject("Attribute")
SetObjectProperty(@ts_lname, "Name", "LastName")
SetObjectProperty(@ts_lname,"Value", @LastName)
AddObjectArrayItem(@ts, "Attributes", @ts_lname)
/* Fill out the OptIn field in the TriggerSend data extension */
SET @ts_optin = CreateObject("Attribute")
SetObjectProperty(@ts_optin, "Name", "OptIn")
SetObjectProperty(@ts_optin,"Value", @OptIn)
AddObjectArrayItem(@ts, "Attributes", @ts_optin)
/* Fill out the Date field in the TriggerSend data extension */
SET @ts_date = CreateObject("Attribute")
SetObjectProperty(@ts_date, "Name", "Date")
SetObjectProperty(@ts_date,"Value", @Date)
AddObjectArrayItem(@ts, "Attributes", @ts_date)
/* Fill out the Date field in the TriggerSend data extension */
SET @ts_ip = CreateObject("Attribute")
SetObjectProperty(@ts_ip, "Name", "IPNaslov")
SetObjectProperty(@ts_ip,"Value", @IPNaslov)
AddObjectArrayItem(@ts, "Attributes", @ts_ip)
AddObjectArrayItem(@ts, "Subscribers", @ts_sub)
SET @ts_statusCode = InvokeCreate(@ts, @ts_statusMsg, @errorCode)
IF @ts_statusCode != "OK" THEN
OUTPUTLINE(CONCAT("Status: ",@TriggerSend_statusMsg," / Code: ",@errorCode))
ENDIF
]%%
Any ideas?