SendGrid: Campaign, Send
Sends an email according to you Campaign settings in SendGrid.
  • C1: Authorization Setting in which API Token is set *
  • C2: Campaign ID *#{EL}
Script (click to open)


function sendCampaign(){

    const auth = configs.get("conf_auth");
    const url = createRequestUrl();

    const response = httpClient.begin()

    const httpStatus = response.getStatusCode();
    engine.log("HTTP Status: " + String(httpStatus));
    if(httpStatus >= 400){
        const responseJson = JSON.parse(response.getResponseAsString());
        let errorMessage = "";
        for(let i = 0 ; i < responseJson.errors.length ; i++){
            errorMessage = responseJson.errors[i].message + "\n";
        throw errorMessage;


function createRequestUrl(){
    const campaignId = configs.get("conf_campaign_id");
    const requestUrl = "" + campaignId +"/schedules/now";
    return requestUrl;


2021-09-12 (C) Questetra, Inc. (MIT License)
The Add-on import feature is available with Professional edition.
Freely modifiable JavaScript (ECMAScript) code. No warranty of any kind.


  • In the HTTP Authorization Settings of the workflow App in which this Add-on is to be used, add the API Key that you created in SendGrid under Settings > API Keys.


%d bloggers like this: