Skip to content

Instantly share code, notes, and snippets.

View wvpv's full-sized avatar

Adam Spriggs wvpv

View GitHub Profile
@wvpv
wvpv / sfmc-triggered-send-soap-request-envelope.xml
Created December 11, 2015 17:26
SFMC Triggered Send SOAP Request
<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing">
<s:Header>
<a:Action s:mustUnderstand="1">Create</a:Action>
<a:MessageID>urn:uuid:9037cc93-13f4-433b-b3f9-250ffa643ea8</a:MessageID>
<a:ReplyTo>
<a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
</a:ReplyTo>
</s:Header>
<s:Body xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
@wvpv
wvpv / sfmc-retrieve-triggeredsenddefinition.amp
Created December 11, 2015 17:27
SFMC Retrieve TriggeredSendDefinition
%%[
var @ret, @filter, @status, @rr
Set @ret = CreateObject("RetrieveRequest")
SetObjectProperty(@ret,"ObjectType","TriggeredSendDefinition")
AddObjectArrayItem(@ret,"Properties","Name")
Set @filter = CreateObject("SimpleFilterPart")
SetObjectProperty(@filter,"Property","CustomerKey")
@wvpv
wvpv / sfmc-retrieve-triggeredsenddefinition.amp
Created December 11, 2015 17:27
SFMC Retrieve TriggeredSendDefinition
%%[
var @ret, @filter, @status, @rr
Set @ret = CreateObject("RetrieveRequest")
SetObjectProperty(@ret,"ObjectType","TriggeredSendDefinition")
AddObjectArrayItem(@ret,"Properties","Name")
Set @filter = CreateObject("SimpleFilterPart")
SetObjectProperty(@filter,"Property","CustomerKey")
@wvpv
wvpv / sfmc-ampscript-regex-match.amp
Created December 11, 2015 17:29
SFMC AMScript Regex Match
%%[
var @str1, @str1b, @str2, @str2b, @str3, @str3b, @str4, @str4b
set @str1 = "whee 1/2 whoop"
set @str1b = replace(@str1,regexmatch(@str1, "\s\w/\w\s" , 0 , "IgnoreCase"), " ")
set @str2 = "whee *derp* whoop"
set @str2b = replace(@str2,regexmatch(@str2, "\*\w+\*" , 0 , "IgnoreCase"), "")
set @str3 = "whee (whatev) whoop"
set @str3b = replace(@str3,regexmatch(@str3, "\s\(.+\)\s" , 0 , "IgnoreCase"), " ")
@wvpv
wvpv / sfmc-profile-sub-center-test-email.html
Created December 11, 2015 18:01
SFMC Profile/Subscription Center Test Email
<html>
<body style="font-family:sans-serif">
<a href="%%profile_center_url%%">Base - Profile/Preference Center</a>
<br/><a href="%%subscription_center_url%%">Base - Subscription Center</a>
<br/><a href="%%unsub_center_url%%">Base - One-Click Unsubscribe</a>
<br/><a href='%%=MicrositeURL(111111,"subscriberMID", "88888888")=%%'>Custom Profile/Preference Center</a>
<br/><a href='%%=MicrositeURL(222222,"subscriberMID", "88888888")=%%'>Custom Subscription Center</a>
<br/><a href='%%=MicrositeURL(333333,"subscriberMID", "88888888")=%%'>One-Click Unsubscribe</a>
<p>This email was sent by:
<b>%%Member_Busname%%</b>
@wvpv
wvpv / sfmc-ampscript-micrositebaseurl-2.amp
Created December 11, 2015 18:13
SFMC AMPScript MicrositeBaseURL() 2
%%[
var @subscriberMID
set @subscriberMID = iif(empty(RequestParameter("subscriberMID")),memberid, RequestParameter("subscriberMID"))
]%%
@wvpv
wvpv / sfmc-ampscript-flexible-content-areas-with-xml1.amp
Created December 11, 2015 18:20
SFMC AMPScript Flexible Content Areas with XML Interfaces 1
%%[
set @products = LookupOrderedRows("ProductDE",6, "AvgCustomerRating desc" ,"ApprovedForEmail","true")
set @productCount = rowcount(@products)
set @productXML = "<products>"
for @i = 1 to @productCount do
set @product = Row(@products, @i)
@wvpv
wvpv / sfmc-ampscript-flexible-content-areas-with-xml2.amp
Created December 11, 2015 18:20
SFMC AMPScript Flexible Content Areas with XML Interfaces 2
%%[ set @productPos = 1 ]%%
%%=TreatAsContent(ContentAreaByName("My Contents\ProductDisplay"))=%%
%%[ set @productPos = 2 ]%%
%%=TreatAsContent(ContentAreaByName("My Contents\ProductDisplay"))=%%
%%[ set @productPos = 3 ]%%
%%=TreatAsContent(ContentAreaByName("My Contents\ProductDisplay"))=%%
<a href="%%profile_center_url%%">Profile/Preference Center</a>
@wvpv
wvpv / sfmc-ampscript-flexible-content-areas-with-xml3.amp
Created December 11, 2015 18:21
SFMC AMPScript Flexible Content Areas with XML Interfaces 3
%%[
set @node = BuildRowsetFromXML(@productXML,concat("/products/product[",@productPos,"]/productImageURL"),1)
set @productImageURL = Field(Row(@node, 1),'Value')
]%%
@wvpv
wvpv / sfmc-ampscript-flexible-content-areas-with-xml4.html
Last active December 11, 2015 18:23
SFMC AMPScript Flexible Content Areas with XML Interfaces 4
<img style="display: block;" src="%%=v(@productImageURL)=%%" alt="" width="150" border="1" />