Sendgril Email send

I have made a sendgrid account and connected it with my Retool app.
The connection has been tested so that should be good.

Now I want to send a basic email.
In this email I have 3 values that are coming from an object.

Sender: {{CurrentUserEmail.value}}
Receiver: {{PaymentRequestOverview.selectedItem.Email}}
Payment amount: {{PaymentRequestOverview.selectedItem.PaidBill}}

How can I do this?
I have tried multiple sendgrid examples and uses the documentations from both Retool and SendGrid, but still I am missing some things.
The rest of the email will be pretty basic in terms of subject and body.

Schermafbeelding 2023-05-06 om 12.11.35

Also when I used the POST mail send operation I got this error.

{
"errors": [
{
"message": "Additional property body is not allowed.",
"field": "body",
"help": null
},
{
"message": "Invalid type. Expected: object, given: string.",
"field": "reply_to",
"help": "Authentication | Twilio"
},
{
"message": "Invalid type. Expected: object, given: string.",
"field": "from",
"help": "Authentication | Twilio"
},
{
"message": "Invalid type. Expected: object, given: string.",
"field": "personalizations.0.from",
"help": "Authentication | Twilio"
},
{
"message": "Invalid type. Expected: array, given: string.",
"field": "personalizations.0.to",
"help": "Authentication | Twilio"
}
]
}

Hey Luc,

Do you mind sharing how the query is set up?

The type errors you are getting is because wrong type is passed.

I.e. if it expects an Object it needs to be {{ {email:currentUserEmail.value} }} instead of just {{currentUserEmail.value}} which is a string. (Same principle applies for other type errors).

I already tried some of your remarks, but I am still no expert in this :slight_smile:

1 Like

One more thing, personalization.to needs [] arround object as it is expecting array.

My current build:

This response again :frowning:

{
"errors": [
{
"message": "Additional property body is not allowed.",
"field": "body",
"help": null
},
{
"message": "Invalid type. Expected: object, given: array.",
"field": "from",
"help": "Authentication | Twilio"
},
{
"message": "Invalid type. Expected: object, given: array.",
"field": "personalizations.0.from",
"help": "Authentication | Twilio"
}
]
}

Both from and personalization.from need to be object type (without [] brackets).

Basically if it states OBJ (object) on left side it needs to follow {{ {email:something.value} }} format, if it's ARR (array) you can pass one or multiple values i.e. {{ [{email:something.value},{email:somethingElse.value}] }} format.

I've attached an example on how I use the integration on my end.

1 Like