Skip to content

Instantly share code, notes, and snippets.

@zuzannamj
Last active November 24, 2019 19:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zuzannamj/f640a04247e07ae44d7087d01f63ffbc to your computer and use it in GitHub Desktop.
Save zuzannamj/f640a04247e07ae44d7087d01f63ffbc to your computer and use it in GitHub Desktop.
%%[
VAR @ts, @tsDef, @ts_extkey, @ts_email, @ts_sub, @ts_statusCode, @ts_statusMsg, @errorCode
SET @ts = CreateObject("TriggeredSend")
SET @tsDef = CreateObject("TriggeredSendDefinition")
SET @ts_extkey = "ExternalKey"
SET @ts_email = "email@example.com"
SetObjectProperty(@tsDef, "CustomerKey", @ts_extkey)
SetObjectProperty(@ts, "TriggeredSendDefinition", @tsDef)
SET @ts_sub = CreateObject("Subscriber")
SetObjectProperty(@ts_sub, "EmailAddress", @ts_email)
SetObjectProperty(@ts_sub, "SubscriberKey", @ts_email)
AddObjectArrayItem(@ts, "Subscribers", @ts_sub)
SET @ts_statusCode = InvokeCreate(@ts, @ts_statusMsg, @errorCode)
IF @ts_statusCode != "OK" THEN
RaiseError(@ts_statusMsg, 0, @ts_statusCode, @errorCode)
ENDIF
]%%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment