Skip to content

Instantly share code, notes, and snippets.

View wvpv's full-sized avatar

Adam Spriggs wvpv

View GitHub Profile
@wvpv
wvpv / NotSent_Tracking.csv
Created January 17, 2023 16:18
Not Sent Tracking Schema
FieldName DataType Length Precision Scale PrimaryKey Required DefaultValue
ClientID Number TRUE TRUE
SendID Number TRUE TRUE
SubscriberKey Text 254 TRUE TRUE
EmailAddress EmailAddress FALSE FALSE
SubscriberID Number TRUE TRUE
ListID Number TRUE TRUE
EventDate Date TRUE TRUE
EventType Text 10 FALSE FALSE
BatchID Number TRUE TRUE
@wvpv
wvpv / short.io.postman_collection.json
Created December 28, 2022 16:43
Short.io Postman Collection Export
{
"info": {
"_postman_id": "7526dd49-78b6-4589-a640-fe7b879ef751",
"name": "Short.io",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "407776"
},
"item": [
{
"name": "Shorten URL",
@wvpv
wvpv / ImportResultsSummary.csv
Created December 21, 2022 16:19
ImportResultsSummary Schema
FieldName DataType Length Precision Scale PrimaryKey Required
ClientID Number TRUE TRUE
ObjectID Text 100 TRUE TRUE
StartDate Date TRUE TRUE
EndDate Date TRUE TRUE
TaskResultID Text 100 FALSE FALSE
ImportDefinitionCustomerKey Text 100 FALSE FALSE
ImportType Text 100 FALSE FALSE
ImportStatus Text 100 FALSE FALSE
ID Number FALSE FALSE
@wvpv
wvpv / ImportResultsSummary.js
Last active August 24, 2023 15:30
Mirror ImportResultsSummary Data to a Data Extension
<script runat="server" type="JavaScript">
Platform.Load("core", "1");
try {
var debug = false;
var prox = new Script.Util.WSProxy();
var DEKey = "ImportResultsSummary";
@wvpv
wvpv / auditevents.js
Last active April 4, 2023 14:06
Mirror AuditEvent Data to a Data Extension
<script runat="server" language="JavaScript">
Platform.Load("core","1");
var debug = false;
// Mirrors AuditEvent REST Object data into a data extension
// - Audit Event Log must be configured in the account first -- Email Studio > Admin > Security Settings > Enable Audit Trail Data Collection: Yes
// - creates its own data extension
// - docs: https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/getAuditEvents.html
// - defaults to the past 30 days of events
@wvpv
wvpv / sfmc-ampscript-two-click-unsubscribe.html
Last active March 18, 2022 21:12
SFMC two-click unsubscribe page
<script runat="server" language="ampscript">
set @debug = 0
set @unsubscribeFromAll = RequestParameter("unsubscribeFromAll") /* append this in the CloudPagesURL function, if desired */
set @submitFlag = RequestParameter("submitFlag")
/* on page load (pre-submit) */
if empty(@submitFlag) then
/* retrieve values from encrypted qs parameter send context */
@wvpv
wvpv / sfmc-ssjs-clear-de-wsproxy.js
Created February 15, 2022 14:32
SFMC Clear a Data Extension using WSProxy
<script runat="server" language="javascript">
var prox = new Script.Util.WSProxy();
var DEKey = "YourDEKey";
var clearDEResponse = prox.performItem("DataExtension",{"CustomerKey": DEKey},"ClearData");
</script>
@wvpv
wvpv / sfmc-republish-triggers-by-folder.js
Created January 6, 2022 19:37
Republish Triggered Send Definitions recursively by folder
<script runat="server">
Platform.Load("core","1");
var debug = false;
var logDE = DataExtension.Init("republish_trigger_log");
try {
/* CONFIG */
var parentCategoryID = 1264; // Triggered Sends
@wvpv
wvpv / sfmc-republish-trigger-log.csv
Created January 6, 2022 19:35
SFMC Republish Trigger script log
FieldName DataType Length Precision Scale PrimaryKey Required DefaultValue
TriggeredSendCustomerKey Text 36 FALSE FALSE
Key Text 100 FALSE FALSE
Value Text FALSE FALSE
insertedDate Date FALSE FALSE getDate()
@wvpv
wvpv / sfmc-triggeredsendsummary-soap-object-retrieve-to-de.js
Created December 28, 2021 15:46
Retrieve TriggeredSendSummary SOAP object data and write to a Data Extension
<script runat="server">
Platform.Load("core","1");
var debug = false;
try {
var prox = new Script.Util.WSProxy();
// credit Jason Hanshaw: https://salesforce.stackexchange.com/questions/178299/setup-an-email-notification-to-admin-when-triggered-sends-exceed-a-level-of-500/230406#230406