Gmail Actions with Google Apps Script

Go to Google Apps Script and start a new blank project.

After you save script, run it and authorize the script to access your Gmail account, then add triggers to call script.