I need a make an json request with my script,
i think the error is body: JSON.stringify because the JSON and other data is working in another script.
let response = await fetch(‘https://api.service.com/fb/sending/sendContent’, {
method: ‘POST’,
body: JSON.stringify(’
{
“subscriber_id”: 3039330322761660,
“data”: {
“version”: “v2”,
“content”: {
“messages”: t
{
“type”: “cards”,
“elements”: p
{
“title”: “Card title”,
“subtitle”: “card text”,
“image_url”: “”,
“action_url”: “https://google.com”
}
],
“image_aspect_ratio”: “horizontal”
}
]
}
},
“otn_topic_name”: “Driver”
}
'),
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer 1170be67ba0d10ac2158fb435fcd6d778'
},
});
console.log(await response.json());