The Platform namespace exposes a set of objects beyond Platform.Function.* that give you direct control over the execution environment. These are available without loading the Core library.

Objects in this Section

Object Description
Platform.Load Load SSJS library namespaces (Core, etc.)
Platform.Variable Read and write AMPscript variables
Platform.Response Control HTTP response (status, redirect, content-type)
Platform.Request Read HTTP request data (query string, POST, headers, cookies)
Platform.Recipient Read subscriber attributes and sendable DE fields for the current recipient

Platform.Load

Before using the Core library (DataExtension, Subscriber, HTTP, etc.), you must call:

Platform.Load("core", "1.1.5");

This must appear at the top of your script block, before any Core library calls. See Platform.Load for details on available libraries and version numbers.


Platform.Variable

The AMPscript–SSJS variable bridge. Read and write AMPscript variables from SSJS:

var email = Platform.Variable.GetValue("@email");
Platform.Variable.SetValue("@result", "processed");

Platform.Request

Read everything about the incoming HTTP request:

var method = String(Platform.Request.Method);                // "GET" or "POST" (CLR value — coerce before comparing)
var q = Platform.Request.GetQueryStringParameter("q");       // URL query param
var body = Platform.Request.GetPostData();                   // raw POST body
var header = Platform.Request.GetRequestHeader("X-Token");  // request header
var cookie = Platform.Request.GetCookieValue("sessionId");  // cookie value

Not to be confused with the Core Library Request object — a distinct object (not an alias) with a smaller, method-only member set that requires Platform.Load("core", ...). Platform.Request works without Platform.Load.


Platform.Response

Control the HTTP response before output is sent:

Platform.Response.ContentType = "application/json";
Platform.Response.Redirect("https://example.com");   // flag optional — 302 by default

ContentType and CharacterSet are setters with an opaque read at runtime: assigning them shapes the HTTP Content-Type header, but reading either one returns an opaque platform value rather than the string you assigned — keep your own variable if you need it back. Redirect() also ends the script immediately — nothing after the call runs, and a try/catch around it does not regain control. See Platform.Response.


Platform.Recipient

Read subscriber attributes and sendable DE fields for the current recipient during a send:

var email = Platform.Recipient.GetAttributeValue("EmailAddress");
var firstName = Platform.Recipient.GetAttributeValue("FirstName");