Upcoming database upgrades. to improve our reliability at 03:30 UTC on Feb. 25 / 7:30pm PT on Feb. 24. Some users may briefly experience slow load times or error messages. Learn more here

JSON rest API script

Topic Labels: Automations
751 3
Showing results for 
Search instead for 
Did you mean: 

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(‘’, {
method: ‘POST’,
body: JSON.stringify(’
“subscriber_id”: 3039330322761660,
“data”: {

“version”: “v2”,
“content”: {
“messages”: [
“type”: “cards”,
“elements”: [
“title”: “Card title”,
“subtitle”: “card text”,
“image_url”: “”,
“action_url”: “
“image_aspect_ratio”: “horizontal”

“otn_topic_name”: “Driver”

headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer 1170be67ba0d10ac2158fb435fcd6d778'

console.log(await response.json());

3 Replies 3

I think the issue is passing the JSON object quoted.

i tried but report: There was an unexpected error while executing your script.

i found the problem, had Input variables set but not used in script. Is a stupid error but i’m new here. Thank you Bill