how to get a email when a new entry in my database

how can i to get a email when a new entry in my database

Hey Avrumi,

You can use the same concept found in this article: Velo Tutorial: Sending an Email on Form Submission | Help Center | Wix.com, but trigger the email from an afterInsert data hook .

its not giving me this the to do
$w(“#sportDataset”).onAfterSave(sendFormData);
its saying that onAfterSave is no such option
any one can help me please

Hi Avrumi,
Did you try Data Hooks ?
Roi Bendet

Use datahooks, they are rock solid.

how can i do it ???
how to set datahooks to be sending me a email evry time a new antry is coming in
thanks

Hi Avrumi,
Start by signing up to https://sendgrid.com/ in order to receive API key
Second, what is the id name of your dataset ?

Roi

the database name is aass

What is the name of the dataset ?
Watch this: Wix Code | How to Create a Custom Form & Connect It to a Database - YouTube
After you’ll connect the dataset to the database collection it’s possible to use the method onAfterSave

Roi

ok i made it but im not geting a email
whts not good

im geting this error
{“errors”:[“Authenticated user is not authorized to send mail”],“message”:“error”}

i see thatin the system of https://sendgrid.com/ but im not geting a email to my privet mail

Hi,
In which step in the articles did you get stuck ?
Roi

I’ve been following along on this thread to accomplish the same thing as Avrumi, and I’m unsure of where to insert the SendGrid API key on the datahook? Is the datahook supposed to be afterInsert or onAfterSave?

You need to add the key in the backend functions as described here .
onAfterSave triggers the sendFormData function.
Roi

The SendGrid API key is in the backend file as described in the article. I’m getting stuck when it comes to the actual data hook - what is an example of " item " and " context " ? As of now, my hook file reads:

export function Customer_Info_AfterInsert(item, context)

All backend files are placed as they’ve been described in the aforementioned [article](How to Send an Email on Form Submission) , as well as the code on the page where the dataset is connected to the Customer_Info database. I’m not receiving any emails, nor am I seeing anything populate within SendGrid.

Additionally, beyond simply generating the API key from SendGrid, are there additional steps one should take to link the 3rd party email server to Wix’s form?

Just an update - I was finally able to accomplish this without using Data Hooks. The error I was making was related to the name of the actual dataset - silly oversight. However, I’d still like to understand the benefit of using Data Hooks for something like this, since it appears automated email upon form submission can, in fact, be achieved without implementing them. @Roi / @Andreas / @ Sam - any thoughts?

@Jess
Would have been nice to let other people know how you made it work without hooks :frowning:

You’re right @Gabriel, my bad for not sharing!

I followed this video tutorial step-by-step (with the appropriate substitutions for my own site data, of course) and voila! Nayeli offers a Google Docs link to the code she uses in the tutorial in the description of the video for easy copy/paste.

Best of luck!

Is there a way to implement values from checkboxes to the email we’re sending? Specifically, I’m having multiple choices for a course registration page and I want to receive an email that says which ones did a student apply for. Thanks!