I want to create an Automation that will sort inbound emails into categories for me, and label them
I already capture the email text content via Zapier which creates a new record for each email and, among other things, writes the email text body to a Multiline text field in the record.
I then need to classify each email, and label the record accordingly. I have about 12 different message types. Each record includes a Single Select field with 12 options, I use this field to label each record according to message type.
My message types are pretty simple and each record can be classified just by looking for and matching a unique text string within the text body from each email - ie the message body can be very long, and I’m looking for particular unique strings within the message.
This seems like it should be a job that Airtable Automation could do pretty easily, but I’m a noob with javascript.
Essentially what I want is a script that will look at each new email and check if the text email body includes one of my unique strings, and depending on which string matches, it will then update the label for the record. If nothing matches, I want it to be labelled ‘Other’.
The message types are mutually exclusive so as soon as it finds the any match, the record can be labelled and the script can wait until the next email record gets written to my Airtable
I’m trying to figure out how to use this example to do the string matching bit, which I think I understand. Not sure how to do the labelling piece