Skip to content

Instantly share code, notes, and snippets.

Adam Spriggs wvpv

View GitHub Profile
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 / 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
Authorization: Bearer YOURAUTHTOKEN
Content-Type: application/json
cache-control: no-cache
"To": {
"Address": "",
"SubscriberKey": "1111",
wvpv / sfmc-rest-token-request-oauth2.txt
Last active Mar 12, 2019
REST token request (OAuth 2.0)
View sfmc-rest-token-request-oauth2.txt
POST /v2/token HTTP/1.1
Content-Type: application/json
cache-control: no-cache
"grant_type": "client_credentials",
"client_id": "YOURCLIENTID",
"client_secret": "YOURCLIENTSECRET",
"scope": "email_read email_write email_send data_extensions_read data_extensions_write",
"account_id": "YOURMID"
wvpv / sfmc-sql-clear-data-extension.sql
Created Jan 29, 2019
Clear a data extension with a SQL query
View sfmc-sql-clear-data-extension.sql
null as Emailaddress
where 0 = 1
/* action: overwrite */
View sfmc-sql-ranking-method1.sql
, x.sendid
from (
, b.sendid
, row_number() over (partition by b.bounceCategory order by newid()) ranking
from _bounce b
) x
View sfmc-sql-ranking-method2.sql
select top 1 with ties
, b.sendid
from _bounce b
order by row_number() over (partition by b.bounceCategory order by newid())
/* list all of the bounce categories and return */
/* a random sendid/jobid associated with each one */
View zip_xyz_axis_calc.sql
, cos(radians(latitude)) * cos(radians(longitude)) xaxis
, cos(radians(latitude)) * sin(radians(longitude)) yaxis
, sin(radians(latitude)) zaxis
from zip_axis
/* credit */
wvpv / sfmc-ampscript-one-click-unsubscribe.html
Created Aug 31, 2018
One-Click Unsubscribe AMPscript
View sfmc-ampscript-one-click-unsubscribe.html
var @debug
var @jid
var @listid
var @batchid
var @email
var @skey
var @reason
var @unsubscribeAll
View CNX18-ECAS-template.html
<div data-type="slot" data-key="init"></div>
body, a, input {font-family:sans-serif;}
<div data-type="slot" data-key="head"></div>
<div data-type="slot" data-key="body"></div>
wvpv / CNX18-ECAS-subscriberReferrals.amp
Created Jun 9, 2018
View CNX18-ECAS-subscriberReferrals.amp
var @sk, @rows, @row, @rowCount, @i
set @sk = AttributeValue("_subscriberkey")
set @rows = LookupRows("SubscriberReferrals", "SubscriberKey", @sk)
set @rowCount = rowcount(@rows)
if @rowCount > 0 then
You can’t perform that action at this time.