Objects and Arrays with Sendgrid
Options
![Felix Tan-2030210](https://us.v-cdn.net/6037124/uploads/userpics/ZV6H4XLKNXLQ/nFNYXIKPZYQ45.jpg)
Felix Tan-2030210
Member ✭
Hi all,
I'm trying to implement the Sendgrid API, but am currently stuck with some customisations.
[image.png]In Xano, I have "personalizations" for my Sendgrid function set to intake the following data:
"personalizations": [
{
"to": Array of objects with "name" and "email",
dynamic_template_data": Object of key/value pairs
]
However, when I try to pass data to this function stack, I can't seem to get the data types formatted correctly. The following data is being passed instead:
"personalizations": [
{
"to": [[]],
"dynamic_template_data": []
}
]
I have my API call configured as such:
"to":[image.png]"dynamic_template_data": [image.png]Could someone point out what I'm doing wrong here?
The portion of Sendgrid's documentation which I'm referring to can be found here: [image.png]
I'm trying to implement the Sendgrid API, but am currently stuck with some customisations.
[image.png]In Xano, I have "personalizations" for my Sendgrid function set to intake the following data:
"personalizations": [
{
"to": Array of objects with "name" and "email",
dynamic_template_data": Object of key/value pairs
]
However, when I try to pass data to this function stack, I can't seem to get the data types formatted correctly. The following data is being passed instead:
"personalizations": [
{
"to": [[]],
"dynamic_template_data": []
}
]
I have my API call configured as such:
"to":[image.png]"dynamic_template_data": [image.png]Could someone point out what I'm doing wrong here?
The portion of Sendgrid's documentation which I'm referring to can be found here: [image.png]
Comments
-
Sengrid says "personalizations can be thought of as an envelope - it defines who should receive an individual message and how the message should be handled"
I might suggest constructing this in a variable first in the function stack. This will give you much more flexibility in formatting it and access to any functions like loops or array functions you might need, then you can add the entire thing to the params section where appropriate of the external API call.
It may also be helpful if they have an example body in the documentation. You could use the import JSON action to help construct it
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback