Help

Upcoming database upgrades. Airtable functionality will be reduced for ~15 minutes at 06:00 UTC on Feb. 4 / 10:00 pm PT on Feb. 3. Learn more here

Add email to subscriber list

Topic Labels: Scripting extentions
231 0
cancel
Showing results for 
Search instead for 
Did you mean: 

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