Skip to main content

Send Airtable email address to a newsletter platform so that it is added as a subscriber.

Click Automations and add this script after “When record is created” step.

The script calls a Webhook which adds the email.

Optionally sends a welcome email, if configured.

PS Most email platforms have a similar Webhook, just replace with the platform of your choice.

let inputConfig = input.config();

var email   = `${inputConfig.email}`;
var name    = `${inputConfig.name}`;
var list    = `${inputConfig.list}`;

var apikey= 'insert-sensorpro-webhook-apikey'; 

var apicall = 
            {
				"AddToList": [""],
                Contact: [
                {
                    "FirstName": "",
                    "LastName": "",
                    "PersonalEMail": ""
                }
                ],
                "UpdateByKey": "email",
                "SendWelcomeEmail": false,
                "SignupFormId":"00000000-0000-0000-0000-000000000000"
            };
			
apicall.Contact[0].PersonalEMail = email;
apicall.Contact[0].FirstName = name;
apicall.AddToList[0] = list;

var url= 'https://apinie.sensorpro.net/api/WHContact/AddUpdateContact/' + apikey;
response = await fetch(url, {
    method: 'POST',
    body: JSON.stringify(apicall),
    headers: {'Content-Type': 'application/json'},
});
Be the first to reply!