This topic was automatically generated from Slack. You can find the original thread here.
this is code you helped me to build, I get “Code Error
Unexpected token (95:8)” can you help me fix it?
import axios from “axios”;
export default defineComponent({
props: {
Instance: {
type: “string”,
label: “Greem-Api device Instance Number”,
},
Green_token: {
type: "string",
label: "Green-Api Device Token",
},
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",
},
file_url: {
type: "string",
label: "כתובת הקובץ לשליחה",
},
file_name: {
type: "string",
label: "שם הקובץ לשליחה כולל סיומת",
},
},
async run({ steps }) {
const apiUrl = https://api.green-api.com/waInstance${**this**.Instance}/${**this**.message_type}/${**this**.Green_token}/
;
const students = this.students_path;
const seatableApiUrl = https://cloud.seatable.io/dtable-server/api/v1/dtables/${**this**.base_uuid}/rows/
;
//const students = steps.get_activ_students.$return_value;
// const apiUrl = ‘https://api.green-api.com/waInstance1101796351/SendMessage/af6a35aea200435aa8c83d09acd9f5e117cf832eb15d4b2094/’;
**for** (**let** i = 0; i < students.length; i++) {
const chatId = ${students[i][**this**.whatsapp]}@c.us
;
const message = this.content.replace(///g, ‘’);
console.log(“מספר:”, students[i][this.whatsapp]);
try {
if (this.message_type === “SendMessage”) {
await axios.post(apiUrl, {
chatId,
message
});
} else if (this.message_type === “SendFileByUrl”) {
await axios.post(apiUrl, {
chatId,
urlFile: this.file_url,
fileName: this.file_name,
caption: message
});
}
} catch (error) {
console.error(error);
}
}
console.log(`API call ${i+1}/${students.length} made successfully.`);
} **catch** (error) {
console.error(`Error making API call ${i+1}/${students.length}:`, error);
}
}
},
_/** // Save the response to the SeaTable table "לוג שליחות"_
_await axios(this, {_
_method: "POST",_
_url: seatableApiUrl,_
_headers: {_
_Authorization: `Token ${this.base_token}`,_
_},_
_data: {_
_row: {'תשובה': response.data, 'מספר': chatId, 'שם תוכן': message_name},_
_table_name: 'לוג שליחות'_
_},_
_});_
_}**/_
});