Embeds.push is not a function

Setting up a send message to discord step using embeds.

{
title: ‘New Strava Activity :biking_man:’,
description: ‘Morning Ride’,
url: ‘https://www.strava.com/activities/1234567890’,
color: 16711680,
thumbnail: {
url: ‘https://your-image-url.com
},
timestamp: new Date().toISOString(),
fields: [
{ name: ‘Sport Type’, value: ‘Ride’, inline: true },
{ name: ‘Distance (m)’, value: ‘11518.5’, inline: true },
{ name: ‘Moving Time (s)’, value: ‘2339’, inline: true },
{ name: ‘Elapsed Time (s)’, value: ‘15500’, inline: true },
{ name: ‘Average Speed (m/s)’, value: ‘4.925’, inline: true },
{ name: ‘Max Speed (m/s)’, value: ‘10.7’, inline: true },
{ name: ‘Elevation Gain (m)’, value: ‘97’, inline: true },
{ name: ‘Average Cadence (rpm)’, value: ‘59.3’, inline: true },
{ name: ‘Average Power (W)’, value: ‘89.6’, inline: true },
{ name: ‘Weighted Avg Power (W)’, value: ‘120’, inline: true },
{ name: ‘Max Power (W)’, value: ‘680’, inline: true },
{ name: ‘Calories Burned’, value: ‘256’, inline: true }
]
}

Error :

embeds.push is not a function

 at Object.run (file:///tmp/__pdg__/dist/code/461e9d17b991afd3cd739cf0a54e1b901466acf3bd9e6499c985ee1c91606b1c/code/actions/send-message-advanced/send-message-advanced.mjs:46:16)
    at null.executeComponent (/var/task/launch_worker.js:316:53)
    at MessagePort.messageHandler (/var/task/launch_worker.js:816:28)

Can you share a screenshot of the step configuration?

Sure can. For now im using raw data just to test.

Thanks for sharing that! So the solution is that you have to wrap that in {{ }} to transform it to code, because the way it is it’s being parsed as a string. And it needs to be an array, not a dictionary.

Given your input above, try this:

{{
  [
    {
      title: "New Strava Activity :biking_man:",
      description: "Morning Ride",
      url: "https://www.strava.com/activities/1234567890",
      color: 16711680,
      thumbnail: {
        url: "https://your-image-url.com",
      },
      timestamp: new Date().toISOString(),
      fields: [
        { name: "Sport Type", value: "Ride", inline: true },
        { name: "Distance (m)", value: "11518.5", inline: true },
        { name: "Moving Time (s)", value: "2339", inline: true },
        { name: "Elapsed Time (s)", value: "15500", inline: true },
        { name: "Average Speed (m/s)", value: "4.925", inline: true },
        { name: "Max Speed (m/s)", value: "10.7", inline: true },
        { name: "Elevation Gain (m)", value: "97", inline: true },
        { name: "Average Cadence (rpm)", value: "59.3", inline: true },
        { name: "Average Power (W)", value: "89.6", inline: true },
        { name: "Weighted Avg Power (W)", value: "120", inline: true },
        { name: "Max Power (W)", value: "680", inline: true },
        { name: "Calories Burned", value: "256", inline: true },
      ]
    }
  ]
}}