Help

Add email to subscriber list

Topic Labels: Scripting extentions
928 0
cancel
Showing results for 
Search instead for 
Did you mean: 
chrisbyrne
5 - Automation Enthusiast
5 - Automation Enthusiast

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.

Screen Shot 2022-10-20 at 10.28.56

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'},
});
0 Replies 0