Using a variable to input send to email into Sendgrid dynamic send

Options
I am trying to use the sendgrid dynamic send function to send an email confirmation to a specific end user when they update a record. 

I have set a get record function to return the only email of the user from the user database.

I then set the to email in the sendgrid function to use the outcome of the get record.

When I do a run and debug I get an error saying that the to email address in the sendgrid function is an incorrect format. 

Does anybody know where I am going wrong?

Comments

  • Sean Montgomery
    Sean Montgomery Administrator

    ADMIN

    Options
     

    Just wanted to reply real quick. Our support staff will check this out tomorrow during US business hours and give you an answer 

    Very glad to have you in the community! 
  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
     - it sounds like you might be inputting the entire response object of your Get Record to the email field.

    You may have a variable like user:

    {
    "email": "example@email.com"
    }

    There is a key-value pair here. Because of this you still need to use dot notation or the GET filter to tell Xano what path within the variable's object to take to retrieve the value you want.

    So you would need something like: user.email
  • Mr Kristian Hilton
    Options
     

    Thanks Michael that worked create. I having trouble with something else I hope  you can help with.

    Is there a way of sending an email to a group of users.

    Using a To Do app as an example. When a new To Do has been added via the app, is there away from the backend to send an email to all users to let them know that a new to do has been added?
  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
     

    Yes, so I would do this:

    Query all records from user
    For Each loop through user variable
    Sendgrid email function... map email to item.email (where item is the iterated list from the loop)

    You can either put all of that in a custom function and insert it to the same API endpoint after your new to do is added... or just build it all directly onto that same API endpoint.