future-vegetable-66332
07/06/2023, 11:51 AMdata
property.
const payload = data;
// Resolve the promise with the payload
resolve(payload);
})
.catch(error => {
// Reject the promise with the error
reject(error);
});
}, 100000);
});
}
// You can use the fetchOutput function like this
fetchOutput().then(payload => {
console.log("Payload:", payload);
}).catch(err => {
console.error("An error occurred:", err);
});
and i get the info i need to send to the client but its shown in console how can i pick up that info to be sent to the user in chat?acceptable-kangaroo-64719
07/06/2023, 11:52 AMconsole.log("Payload:", payload);
, save the payload to a variable like workflow.myVar = payload
Then you can ue a text card or other content and write @myVar
to share the content with the userfuture-vegetable-66332
07/06/2023, 11:54 AMfuture-vegetable-66332
07/06/2023, 12:03 PMfuture-vegetable-66332
07/06/2023, 12:04 PMfuture-vegetable-66332
07/06/2023, 12:09 PMfuture-vegetable-66332
07/06/2023, 12:37 PMfuture-vegetable-66332
07/06/2023, 1:21 PMfuture-vegetable-66332
07/06/2023, 1:30 PMacceptable-kangaroo-64719
07/06/2023, 2:48 PMfuture-vegetable-66332
07/06/2023, 3:29 PMfuture-vegetable-66332
07/06/2023, 3:35 PMfuture-vegetable-66332
07/06/2023, 3:36 PMacceptable-kangaroo-64719
07/06/2023, 5:15 PMjs
const headers = {
'User-Agent': 'YourCustomUserAgent/1.0' // Replace with your custom User-Agent header value
};
// This function wraps your axios call and returns a Promise that resolves with the formatted response data
async function fetchOutput() {
return new Promise((resolve, reject) => {
setTimeout(async () => {
try {
const response = await axios.get(url, { headers });
const data = response.data;
// Format your response as needed here. Assuming your payload is just the data property.
const payload = data;
// Resolve the promise with the payload
resolve(payload);
} catch (error) {
// Reject the promise with the error
reject(error);
}
}, 100000);
});
}
// You can use the fetchOutput function like this
fetchOutput()
.then(payload => {
console.log("Payload:", payload);
})
.catch(err => {
console.error("An error occurred:", err);
});