This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
======================================================= | |
Title: Dad Joke CloudPage SSJS code for Slack API Integration. | |
Author: Cameron Robert | |
------------------------------------------------------- | |
Instructions: | |
1: Create a Javascript Code Resource CloudPage | |
2: Paste the below code to the page | |
3: Use the Cloud Page URL as "Request URL" for a "Slash Commands" component in the Slack API Dashboard. | |
4: Save and Authorise your Slack app to a workspace/channel, and use the Slash Command to interact |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
======================================================= | |
Title: SFMC DE Record Count Slack API | |
Author: Cameron Robert | |
------------------------------------------------------- | |
Instructions: | |
1: Create a Javascript Code Resource CloudPage | |
2: Paste the below code to the page | |
3: Use the Cloud Page URL as "Request URL" for a "Slash Commands" component in the Slack API Dashboard. | |
4: Save and Authorise your Slack app to a workspace/channel. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script runat="server"> | |
/*Code provided as is without warranty - make sure you understand what this code does before using it - use at your own risk*/ | |
Platform.Load("Core","1"); | |
try{ | |
var dename = Request.GetQueryStringParameter("de");; | |
var prox = new Script.Util.WSProxy(); | |
var cols = ["Name","CustomerKey","CategoryID"]; | |
var filter = { | |
Property: "Name", | |
SimpleOperator: "like", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT DISTINCT | |
a.SubscriberKey | |
, a.EmailAddress | |
, j.JobID | |
, j.EmailName | |
, s.EventDate | |
, j.SendClassificationType | |
, j.SendType | |
, a.DateUnsubscribed | |
FROM _Subscribers a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%[ | |
SET @json = '{"Flights": [{"Origin": "IND","Dest": "NYC","Price": 100.0},{"Origin": "IND","Dest": "LAX","Price": 200.0},{"Origin": "IND","Dest": "SEA","Price": 500.0,"PerBagSurcharge": 25}]}' | |
SET @rows = BuildRowsetFromJson(@json, '$.Flights[*]', 1) | |
]%% | |
<table border=1> | |
<tr><th>Origin</th><th>Dest</th><th>Price</th><th>PerBag Surcharge</th></tr> | |
%%[FOR @i = 1 TO Rowcount(@rows) DO]%% | |
<tr> | |
%%[FOR @c = 1 TO 4 DO]%% | |
<td>%%=Field(Row(@rows,@i),@c)=%%</td> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%[ | |
SET @fname = RequestParameter('fname') | |
SET @lname = RequestParameter('lname') | |
SET @email = RequestParameter('email') | |
IF NOT EMPTY(RequestParameter('pref1')) THEN | |
SET @Cats = "true" | |
ELSE | |
SET @Cats = "false" | |
ENDIF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%[ | |
SET @json = '{"menu": { | |
"id": "file", | |
"value": "File", | |
"popup": { | |
"menuitem": [ | |
{"value": "New", "onclick": "CreateDoc(a)"}, | |
{"value": "Open", "onclick": "OpenDoc(b)"}, | |
{"value": "Save", "onclick": "SaveDoc(c)"} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%[ | |
/* | |
Ref: https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/httppost2.html | |
Ref: https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/access-token-s2s.html | |
Ref: https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/validateEmail.html | |
*/ | |
/*=== (Unsafe) Plain Text API Credentials ===*/ | |
SET @client_id = "xxxxxxxxxxxxxxxxxx" | |
SET @client_secret = "xxxxxxxxxxxxxxxxxx" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%[ | |
SET @rows = LookupRows("DENAME", "Key", "Value") | |
FOR @i = 1 to RowCount(@rows) DO | |
]%% | |
EmailAddress: %%=Field(Row(@rows,i), 'EmailAddress')=%%<br> | |
%%[ | |
NEXT @i | |
]%% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script runat="server"> | |
Platform.Load("Core","1"); | |
try { | |
//Do Functions Here | |
} | |
catch(error) { | |
Write('Message: '+ Stringify(error)); | |
} |
OlderNewer