Skip to content

Instantly share code, notes, and snippets.

Adam Spriggs wvpv

Block or report user

Report or block wvpv

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@wvpv
wvpv / asc.json
Created Jun 17, 2019
JSON ASC Sample
View asc.json
[
{
"sku":"123",
"name":"Square",
"url":"https://spmvs.com?sku=123"
},
{
"sku":"456",
"name":"Circle",
"url":"https://spmvs.com/?sku=456"
@wvpv
wvpv / asc.xml
Created Jun 17, 2019
ASC XML sample
View asc.xml
<?xml version="1.0" encoding="UTF-8"?>
<cart>
<items>
<item>
<sku><![CDATA[123]]></sku>
<name><![CDATA[Square]]></name>
<url><![CDATA[https://spmvs.com?sku=123]]></url>
</item>
<item>
<sku><![CDATA[456]]></sku>
View ExampleAJAX1-get-cities.js
<script type="text/javascript" runat="server">
Platform.Load("core", "1");
var state = Request.GetQueryStringParameter("state");
var citiesDE = DataExtension.Init("Cities");
var cities = citiesDE.Rows.Lookup(["state"], [state], 100);
cities = cities ? cities : "";
Write('{"results":' + Stringify(cities) + '}');
</script>
View ExampleAJAX1-get-cities.js
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Cities</title>
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
</head>
<body>
<h4>Cities</h4>
View ExampleAJAX3-get-cities.js
<script type="text/javascript" runat="server">
Platform.Load("core", "1");
var authCookie = Platform.Request.GetCookieValue('auth');
if (authCookie) {
var state = Request.GetQueryStringParameter("state");
var citiesDE = DataExtension.Init("Cities");
var cities = citiesDE.Rows.Lookup(["state"], [state], 100);
View ExampleAJAX3.html
<script runat="server">
Platform.Load("core", "1");
var time = Platform.Function.Now();
var today = new Date(time);
var tomorrow = today.setDate(today.getDate() + 1);
Platform.Response.SetCookie("auth", Platform.Function.GUID(), tomorrow, true);
</script>
<!DOCTYPE html>
View ExampleAJAX2-get-cities
<script type="text/javascript" runat="server">
Platform.Load("core", "1");
var authIP = Platform.Request.GetRequestHeader('auth');
var thisIP = Platform.Request.ClientIP;
if (authIP == thisIP) {
var state = Request.GetQueryStringParameter("state");
View ExampleAJAX2
<script runat="server">
Platform.Load("core", "1");
var thisIP = Platform.Request.ClientIP;
</script>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
@wvpv
wvpv / sfmc-ssjs-list-all-publicationlists.js
Created Mar 20, 2019
List all PublicationLists with SSJS
View sfmc-ssjs-list-all-publicationlists.js
<script type="text/javascript" runat="server">
Platform.Load("core", "1");
var allPublicationLists = getAllPublicationLists();
for (var i in allPublicationLists) {
Write("\n" + allPublicationLists[i]["ID"] + "|" +allPublicationLists[i]["Client"]["ID"] + "|" +allPublicationLists[i]["Name"]);
}
@wvpv
wvpv / sfmc-rest-trigger-multiple-emails.txt
Created Mar 12, 2019
Trigger multiple emails with REST
View sfmc-rest-trigger-multiple-emails.txt
POST /messaging/v1/messageDefinitionSends/key:YOURTSDEXTERNALKEY/sendBatch HTTP/1.1
Host: YOURENDPOINT.rest.marketingcloudapis.com
Authorization: Bearer YOURAUTHTOKEN
Content-Type: application/json
cache-control: no-cache
[
{
"To": {
"Address": "neo@example.com",
"SubscriberKey": "1111",
You can’t perform that action at this time.