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
%%[ | |
SET @payload = '{"text":"Hello from SFMC!"}' | |
SET @post = HTTPPOST2('https://hooks.slack.com/services/xxxxxxxxx/yyyyyyyyyyyy/zzzzzzzzzzzzzzz','text/plain',@payload,true,@output,@header) | |
]%% | |
@post= %%=v(@post)=%% <br> | |
@output= %%=v(@output)=%% <br> | |
@header= %%=v(@header)=%% <br> |
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{ | |
var url = 'https://hooks.slack.com/services/xxxxxxxx/yyyyyyyyyyyy/zzzzzzzzzzzzzzzz'; | |
var contentType = 'text/plain'; | |
var payload = '{"text":"Now this is SSJS!"}'; | |
var headerNames = []; | |
var headerValues = []; | |
var result = HTTP.Post(url, contentType, payload, headerNames, headerValues); |
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"); | |
/* ======================================================= */ | |
/* ======================== Config ======================= */ | |
var authurl = "authmarketingcloudapiscom/"; //Get this from Setup | |
var client_id = "xxxxxxxxxxxxxxxxx"; //Get this from Setup | |
var client_secret = "yyyyyyyyyyyyyyy"; //Get this from Setup | |
var slackwebhook = "zzzzzzzzzzzzzzzzzzzzz"; //Get this from Slack API | |
var gtm = 10; //This is your GMT modifier for your timezone | |
var notify = "@channel"; //use this to notify the channel or specific people |
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 @text = "Cameron Robert" | |
SET @key = "8ce32e59" /* https://www.browserling.com/tools/random-hex */ | |
OutputLine(Concat("Encrypted: ", EncryptSymmetric(@text, "des;mode=ecb;padding=pkcs7", @null, @key),"<br><br>")) | |
SET @enctext = "iJwqnvvKdIIn7AKQOg1LHA==" | |
OutputLine(Concat("Decrypted: ", DecryptSymmetric(@enctext, "des;mode=ecb;padding=pkcs7", @null, @key),"<br><br>")) | |
]%% |
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 Your 3 Keys*/ | |
SET @sym = 'SymmetricKey ExternalKey' | |
SET @IV = 'IV ExternalKey' | |
SET @Salt = 'Salt ExternalKey' | |
/*Input Auth URI Details*/ | |
SET @authurl = 'Authentication Base URI' | |
/*TEMP API Key Details - To Delete after generating encrypted values*/ |
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 prox = new Script.Util.WSProxy(); | |
var cols = ["Name","CustomerKey","FieldType","IsPrimaryKey", "MaxLength"]; | |
var filter = { | |
Property: "Name", | |
SimpleOperator: "like", | |
Value: "email" |
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
<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 prox = new Script.Util.WSProxy(); | |
//================== https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/accountuser.html | |
var cols = ["Name","CustomerKey","NotificationEmailAddress", "UserID", "ActiveFlag", "Email", "IsAPIUser", "AccountUserID", "LastSuccessfulLogin", "CreatedDate", "Roles"]; | |
//================= https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/ssjs_WSProxy_basic_retrieve.html | |
var filter = { | |
LeftOperand: {Property: "Email",SimpleOperator: "like",Value: "@"}, |
OlderNewer