Why am I Getting an Error After Copying a Working Step: "Shorthand Property Assignments are Valid Only in Destructuring Patterns (22:22)"?

I apologize for the inconvenience. It seems there’s an issue with the API request. To better understand the problem, could you please provide more information about the API call you’re making? Specifically, the request method, URL, headers, and any data you’re sending in the request. This will help me identify the cause of the error and suggest a solution.

I already did! Can’t you read our earlier chat steps?

I apologize for the confusion earlier. I reviewed our previous conversation and it seems the issue is related to the Green API returning a 466 error (ERR_BAD_REQUEST). To help you further, I need to take a closer look at the request you’re making. Could you please share the complete code you’re using in the Pipedream component? This will help me identify any potential issues and provide a solution.

import axios from “axios”;

export default defineComponent({
props: {
Instance: {
type: “string”,
label: “Greem-Api device Instance Number”,
default: “1101795721”,
},
Green_token: {
type: “string”,
label: “Green-Api Device Token”,
default: “7bd245ff67294e609b7ff35bfe473f29ea49cc8a045b4c6fbd”,
},
students_path: {
type: “string”,
label: “Students array step path”,
},
content: {
type: “string”,
label: “Whatsapp Content Path”,
},
content_name: {
type: “string”,
label: “Whatsapp Content Name Path”,
},
whatsapp: {
type: “string”,
label: “Whatsapp Number Colum Name”,
},
base_uuid: {
type: “string”,
label: “Base Uuid”,
},
base_token: {
type: “string”,
label: “Base Token”,
},
logs_table_name: {
type: “string”,
label: “Logs Table Name”,
default: “לוג שליחות”,
},
message_type: {
type: “string”,
label: “השדה המציין את סוג ההודעה לשליחה”,
default: “SendMessage”,
},
},

**async** run({ steps }) {
**const** apiUrl = `https://api.green-api.com/waInstance${**this**.Instance}/SendMessage/${**this**.Green_token}/`;
**const** students = **this**.students_path;
**const** seatableApiUrl = `https://cloud.seatable.io/dtable-server/api/v1/dtables/${**this**.base_uuid}/rows/`;

**const** chatId = `mailto:${**this**.whatsapp}@c.us`;
**const** message = **this**.content;

**function** encodeUrlsInMessage(message) {
  **const** urlRegex = /https?:\/\/[^\s]+/**g**;
  **return** message.replace(urlRegex, (url) => encodeURIComponent(url));
}

**const** decodedUrl = decodeURIComponent(message);

**try** {
  **await** [axios.post](http://axios.post)(apiUrl, {
    chatId,
    message: decodedUrl,
    linkPreview: **true**,
  });

  console.log(`API call made successfully.`);
} **catch** (error) {
  console.error(`Error making API call:`, error);
}

},
});

I apologize for the confusion earlier. I reviewed the provided code and it seems you’re trying to send a WhatsApp message using the Green API. I noticed that you’re using the mailto: prefix in the chatId variable, which might be causing the issue. The mailto: prefix is not required for WhatsApp chat IDs. Please try updating the chatId variable like this: ```
const chatId = ${this.whatsapp}@c.us;

we still get in the log:
message: ‘Request failed with status code 466’,
name: ‘AxiosError’,
code: ‘ERR_BAD_REQUEST’,

I apologize for the inconvenience. Let’s try adding some headers to the API request to see if it resolves the issue. Please update the axios.post call in your code like this: ```
await axios.post(apiUrl, { chatId, message: decodedUrl, linkPreview: true, }, { headers: { ‘Content-Type’: ‘application/json’, }, });

still we have error. I past now the hole log:

(file:///tmp/pdg/dist/code/55350682bb71c78907c0deb2f82ae38b436186e3324edf6f1cb4aad62a996d8d/node_modules/.pnpm/axios@1.4.0/node_modules/axios/lib/core/settle.js:19:12)
at IncomingMessage.handleStreamEnd (file:///tmp/pdg/dist/code/55350682bb71c78907c0deb2f82ae38b436186e3324edf6f1cb4aad62a996d8d/node_modules/.pnpm/axios@1.4.0/node_modules/axios/lib/adapters/http.js:570:11)
at IncomingMessage.emit (events.js:412:35)
at null.endReadableNT (internal/streams/readable.js:1333:12)
at process.processTicksAndRejections (internal/process/task_queues.js:82:21)
{
message: ‘Request failed with status code 466’,
name: ‘AxiosError’,
code: ‘ERR_BAD_REQUEST’,
config: {
transitional: {
silentJSONParsing: true,
forcedJSONParsing: true,
clarifyTimeoutError: false
},
adapter: [ ‘xhr’, ‘http’ ],
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 0,
xsrfCookieName: ‘XSRF-TOKEN’,
xsrfHeaderName: ‘X-XSRF-TOKEN’,
maxContentLength: -1,
maxBodyLength: -1,
env: { FormData: [Function], Blob: null },
validateStatus: [Function: validateStatus],
headers: AxiosHeaders {
Accept: ‘application/json, text/plain, /’,
‘Content-Type’: ‘application/json’,
‘User-Agent’: ‘axios/1.4.0’,
‘Content-Length’: ‘2835’,
‘Accept-Encoding’: ‘gzip, compress, deflate, br’
},
method: ‘post’,
url: ‘https://api.green-api.com/waInstance1101795721/SendMessage/7bd245ff67294e609b7ff35bfe473f29ea49cc8a045b4c6fbd/’,
data: ‘{“chatId”:“וואטסאפ@c.us”,“message”:"(ניתן להאזין להודעה זו בקישור הנמצא בסופה) \n\nמועדי המקדש ליום י\"ח תמוז - \“דע מאין באת\”\n\nבוקר טוב !\n\n\“כל מסע גדול מתחיל בצעד אחד קטן\”.\n\nאנו מתחילים היום יחידה בת 3 שבועות העומדת בפני עצמה ונכתבה במקור בתור \“מיני קורס\” בנושא מהות המקדש והקרבנות. \n\nהמסע שלפנינו הוא מסע מרתק,\n\nמסע משמעותי ועמוק בע\"ה.\n\nבחלק הראשון של המסע\n\nשיתקיים במשך השבוע הקרוב,\n\nאנחנו נניח בע\“ה את היסודות והמושגים\n\nשישמשו אותנו בהמשך המסע.\n\nאבל כדי שהמסע הזה יהיה בעל נפח,\n\nכדי שנוכל להתבונן אחורה בכל שלב שנבחר\n\nאנחנו מבקשים להקדיש את היום הזה\n\nכדי להתבונן על נקודת הפתיחה\n\nבבחינת:\n\n\“דע מאין באת ולאן אתה הולך\”.\n\nהמושג הזה \“בית המקדש\”\n\nבאמת כולל בתוכו רעיונות, מושגים, תהיות ושאלות רבות.\n\nההצעה שלי להתבוננות היום,\n\nהיא לנסות לסכם ולתמלל את בליל המחשבות האלה.\n\n המטרה היא שלאורך הדרך נוכל לשים לב\n\nאילו מחשבות ושאלות קיבלו מענה\n\nואילו עדיין לא.\n\nיש לך אפשרות לבחור כיצד בדיוק לעשות את זה.\n\nיש מי שיתאים לו רק להקדיש לכך כמה שניות במחשבה.\n\nיש מי שירשום את הדברים על דף כדי שיוכל לחזור לכך בהמשך. \n\nאבל ההמלצה שלי היא לכתוב את הדברים כאן, במענה להודעה הזו.\n\nכך יהיה לך תיעוד מסודר במקום אחד של כל התהליך. \n\n(אני לא מבטיח תגובה אבל ייתכנו הפתעות…).\n\nאז לסיכום,\n\nהנה ההצעה להיום:\n\nלשים לב כשאני שומע את המילים \“בית המקדש\”:\n\nא. אילו תחושות ורגשות עולות בתוכי, אם בכלל?\n\nב. אילו מחשבות, תקוות או פחדים עולים, אם בכלל?\n\nג. אילו שאלות ותהיות עולות בתוכי, אם בכלל?\n\nכאמור,\n\nמומלץ להקדיש כמה שניות לחשיבה ולכתוב את מה שעולה כמענה להודעה. \n\nשנשמת המקדש תאיר את יומך,\n\nאוריאל\n\nלהאזנה להודעה זו (הוקלט במקור עבור גרסת המיילים):\n\n\n\nhttps\\:<//clyp.it/fyeqgvmh?token=ff9d44100b96aef331568259a11b33ec>\n\n\n”,“linkPreview”:true}’
},
request: <ref **1> ClientRequest {
_events: [Object: null prototype] {
abort: [Function (anonymous)],
aborted: [Function (anonymous)],
connect: [Function (anonymous)],
error: [Function (anonymous)],
socket: [Function (anonymous)],
timeout: [Function (anonymous)],
prefinish: [Function: requestOnPrefinish]
},
_eventsCount: 7,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: false,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
_defaultKeepAlive: true,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: ‘’,
finished: true,
_headerSent: true,
socket: TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
secureConnecting: false,
_SNICallback: null,
servername: ‘api.green-api.com’,
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object: null prototype],
_eventsCount: 10,
connecting: false,
_hadError: false,
_parent: null,
_host: ‘api.green-api.com’,
_readableState: [ReadableState],
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: ‘’,
server: undefined,
_server: null,
ssl: [TLSWrap],
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: [Circular **1],
[Symbol(res)]: [TLSWrap],
[Symbol(verified)]: true,
[Symbol(pendingSession)]: null,
[Symbol(async_id_symbol)]: 264,
[Symbol(kHandle)]: [TLSWrap],
[Symbol(kSetNoDelay)]: false,
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0,
[Symbol(connect-options)]: [Object],
[Symbol(RequestTimeout)]: undefined
},
_header: ‘POST /waInstance1101795721/SendMessage/7bd245ff67294e609b7ff35bfe473f29ea49cc8a045b4c6fbd/ HTTP/1.1\r\n’ +
‘Accept: application/json, text/plain, /\r\n’ +
‘Content-Type: application/json\r\n’ +
‘User-Agent: axios/1.4.0\r\n’ +
‘Content-Length: 2835\r\n’ +
‘Accept-Encoding: gzip, compress, deflate, br\r\n’ +
‘Host: api.green-api.com\r\n’ +
‘Connection: close\r\n’ +
‘\r\n’,
_keepAliveTimeout: 0,
_onPendingData: [Function: noopPendingOutput],
agent: Agent {
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
defaultPort: 443,
protocol: ‘https:’,
options: [Object],
requests: {},
sockets: [Object],
freeSockets: {},
keepAliveMsecs: 1000,
keepAlive: false,
maxSockets: Infinity,
maxFreeSockets: 256,
scheduling: ‘lifo’,
maxTotalSockets: Infinity,
totalSocketCount: 1,
maxCachedSessions: 100,
_sessionCache: [Object],
[Symbol(kCapture)]: false
},
socketPath: undefined,
method: ‘POST’,
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
path: ‘/waInstance1101795721/SendMessage/7bd245ff67294e609b7ff35bfe473f29ea49cc8a045b4c6fbd/’,
_ended: true,
res: IncomingMessage {
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 4,
_maxListeners: undefined,
socket: [TLSSocket],
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: ‘1.1’,
complete: true,
headers: [Object],
rawHeaders: [Array],
trailers: {},
rawTrailers: [],
aborted: false,
upgrade: false,
url: ‘’,
method: null,
statusCode: 466,
statusMessage: ‘Client Error (466)’,
client: [TLSSocket],
_consuming: false,
_dumped: false,
req: [Circular **1],
responseUrl: ‘https://api.green-api.com/waInstance1101795721/SendMessage/7bd245ff67294e609b7ff35bfe473f29ea49cc8a045b4c6fbd/’,
redirects: [],
[Symbol(kCapture)]: false,
[Symbol(RequestTimeout)]: undefined
},
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: ‘api.green-api.com’,
protocol: ‘https:’,
_redirectable: Writable {
_writableState: [WritableState],
_events: [Object: null prototype],
_eventsCount: 3,
_maxListeners: undefined,
_options: [Object],
_ended: true,
_ending: true,
_redirectCount: 0,
_redirects: [],
_requestBodyLength: 2835,
_requestBodyBuffers: [],
_onNativeResponse: [Function (anonymous)],
_currentRequest: [Circular **1],
_currentUrl: ‘https://api.green-api.com/waInstance1101795721/SendMessage/7bd245ff67294e609b7ff35bfe473f29ea49cc8a045b4c6fbd/’,
[Symbol(kCapture)]: false
},
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype] {
accept: [Array],
‘content-type’: [Array],
‘user-agent’: [Array],
‘content-length’: [Array],
‘accept-encoding’: [Array],
host: [Array]
}
},
response: {
status: 466,
statusText: ‘Client Error (466)’,
headers: AxiosHeaders {
server: ‘nginx/1.14.0 (Ubuntu)’,
date: ‘Fri, 07 Jul 2023 03:03:30 GMT’,
‘content-type’: ‘application/json’,
‘content-length’: ‘392’,
connection: ‘close’,
vary: ‘Origin, Access-Control-Request-Method, Access-Control-Request-Headers’,
‘x-ratelimit-remaining’: ‘49’,
‘x-ratelimit-replenish-rate’: ‘50’
},
config: {
transitional: [Object],
adapter: [Array],
transformRequest: [Array],
transformResponse: [Array],
timeout: 0,
xsrfCookieName: ‘XSRF-TOKEN’,
xsrfHeaderName: ‘X-XSRF-TOKEN’,
maxContentLength: -1,
maxBodyLength: -1,
env: [Object],
validateStatus: [Function: validateStatus],
headers: [AxiosHeaders],
method: ‘post’,
url: ‘https://api.green-api.com/waInstance1101795721/SendMessage/7bd245ff67294e609b7ff35bfe473f29ea49cc8a045b4c6fbd/’,
data: ‘{“chatId”:“וואטסאפ@c.us”,“message”:"(ניתן להאזין להודעה זו בקישור הנמצא בסופה) \n\nמועדי המקדש ליום י\"ח תמוז - \“דע מאין באת\”\n\nבוקר טוב !\n\n\“כל מסע גדול מתחיל בצעד אחד קטן\”.\n\nאנו מתחילים היום יחידה בת 3 שבועות העומדת בפני עצמה ונכתבה במקור בתור \“מיני קורס\” בנושא מהות המקדש והקרבנות. \n\nהמסע שלפנינו הוא מסע מרתק,\n\nמסע משמעותי ועמוק בע\"ה.\n\nבחלק הראשון של המסע\n\nשיתקיים במשך השבוע הקרוב,\n\nאנחנו נניח בע\“ה את היסודות והמושגים\n\nשישמשו אותנו בהמשך המסע.\n\nאבל כדי שהמסע הזה יהיה בעל נפח,\n\nכדי שנוכל להתבונן אחורה בכל שלב שנבחר\n\nאנחנו מבקשים להקדיש את היום הזה\n\nכדי להתבונן על נקודת הפתיחה\n\nבבחינת:\n\n\“דע מאין באת ולאן אתה הולך\”.\n\nהמושג הזה \“בית המקדש\”\n\nבאמת כולל בתוכו רעיונות, מושגים, תהיות ושאלות רבות.\n\nההצעה שלי להתבוננות היום,\n\nהיא לנסות לסכם ולתמלל את בליל המחשבות האלה.\n\n המטרה היא שלאורך הדרך נוכל לשים לב\n\nאילו מחשבות ושאלות קיבלו מענה\n\nואילו עדיין לא.\n\nיש לך אפשרות לבחור כיצד בדיוק לעשות את זה.\n\nיש מי שיתאים לו רק להקדיש לכך כמה שניות במחשבה.\n\nיש מי שירשום את הדברים על דף כדי שיוכל לחזור לכך בהמשך. \n\nאבל ההמלצה שלי היא לכתוב את הדברים כאן, במענה להודעה הזו.\n\nכך יהיה לך תיעוד מסודר במקום אחד של כל התהליך. \n\n(אני לא מבטיח תגובה אבל ייתכנו הפתעות…).\n\nאז לסיכום,\n\nהנה ההצעה להיום:\n\nלשים לב כשאני שומע את המילים \“בית המקדש\”:\n\nא. אילו תחושות ורגשות עולות בתוכי, אם בכלל?\n\nב. אילו מחשבות, תקוות או פחדים עולים, אם בכלל?\n\nג. אילו שאלות ותהיות עולות בתוכי, אם בכלל?\n\nכאמור,\n\nמומלץ להקדיש כמה שניות לחשיבה ולכתוב את מה שעולה כמענה להודעה. \n\nשנשמת המקדש תאיר את יומך,\n\nאוריאל\n\nלהאזנה להודעה זו (הוקלט במקור עבור גרסת המיילים):\n\n\n\nhttps\\:<//clyp.it/fyeqgvmh?token=ff9d44100b96aef331568259a11b33ec>\n\n\n”,“linkPreview”:true}’
},

And I don’t have enough space to continue…