Apify Discord Mirror

M
Marcin
Offline, last seen 5 months ago
Joined August 30, 2024
Im trying to pass a returned variable from pageFunctions via webhooks, but I cannot get the value.
My code:
async function pageFunction(context) {
await context.skipLinks();
const $ = context.jQuery;
const pageTitle = $('title').first().text();
const matches = pageTitle.match(/((\d+))/);
const numberOfTests = 0;

if (matches !== null) {
numberOfTests = parseInt(matches[1]);
}
context.log.info(${numberOfTests})

return {
numberOfTests
}
}

Webhooks integration JSON:
{
"tests": {{resource.numberOfTests}}
}

What am I doing wrong? I tried also:
{
"tests": {{numberOfTests}}
}
but this returns a validation error.
4 comments
L
M