Need help to implement Apify webhook. It takes some time to complete a task. I want to add a Apify webhook which will run another task but not sure how to do that.
$.ajax({
url : 'https://api.apify.com/v2/actor-tasks/XXXXXXX/runs?token=XXXXXXXX&waitForFinish=120',
method : 'POST',
contentType: 'application/json',
dataType: 'json',
data : JSON.stringify ({
"queries" : "Outreach link building"
}),
success:function(result) {
console.log(result);
}
});
The webhook will then call the following task:
$.ajax({
url : `https://api.apify.com/v2/datasets/${datasetId}/items?format=json`,
method : 'GET',
contentType: 'application/json; charset=utf-8',
success:function(response) {
console.log(response); // Items from dataset
}
});
Btw if I am wrong with the way I want to implement what I need, please let me know your suggestion.