Triggered Emails not sending I need clarification answer ASAP

I have a wix-form contact form that gets filled in as a membership application form.

I have a code that connects the data filled into the form to a separate database that is supposed give an approval or denial of membership. This is working great until the approval denial part.

I want to define what membership is for us before I move on. We don’t want people logging in and out of the site. They are not site members they are our organization members. We just need a database record of when they sign up and their status. That status needs to be followed up with a welcome email or a denial email.

I had been using send grid for this and it worked really nicely, but it was such a plain email. I though with triggers I could create something nice, but I have hit a wall. The form is not triggering the email.

The form is a dynamic page connected to the custom database not the wix-form database. It is a read and write form because the approval choice has to be added to the database then the email gets triggered.

Important things to note:

  1. The Contact is not a member
  2. The Contact is not logged in
  3. The Contact is entered on the site Contact List
  4. I am using an if/else to tigger different emails based on outcome.
  5. I DO NOT want site members only Contacts

Here is the code I am using:

 import wixCRM from 'wix-crm';
import wixData from 'wix-data';
$w.onReady(function () {

});

export function submit_click(event, $w) {
 let toSave = {
"companyName": $w('#company').value,
"email": $w('#email').value,
"phone": $w('#phone').value,
"website": $w('#website').value,
"address": $w('#address').value,
 };
                    wixData.save("Member_Business_Directory", toSave)
                        .then((results) => {
 let item = results;
                        })
                        .catch((err) => {
 let errorMsg = err;
                        });

                }
 wixCRM.createContact({
 "name": $w('#firstName').value,
 "email": [$w("#email").value],
 "memberstatus": $w("#radioGroup1").value
  })

 if ($w('#radioGroup1').value === 'Approved') {
                    ((contactId) => {
                    wixCRM.emailContact("RVeZK4G", contactId, {
 "variables": {
 "name": $w('#firstName').value,
                        }
                        })
                        .then(() => {
 // do something after the email was sent
                        })
                        .catch((err) => {
 // handle the error if the email wasn't sent
                        });
                    });
                    }
else { 
                      ((contactId) => {
                        wixCRM.emailContact("RVecAfP", contactId, {
 "variables": {
 "name": $w('#firstName').value,
                        }
                        })
                        .then(() => {
 // do something after the email was sent
                        })
                        .catch((err) => {
 // handle the error if the email wasn't sent
                        });
                    });
}

Here is the Page URL: https://www.sleepyhollowtarrytownchamber.com/membershipapplicationapprovals/status

My questions are:

  1. Should I change the contactID to email?
  2. Is this just not possible at the moment?