Skip to content

Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.

Fixed addWebhook create webhook param

drobnikjcabda0e3e4e5
diff --git a/src/actor.js b/src/actor.js
index f94b92fe9..2fd84ec04 100644
--- a/src/actor.js
+++ b/src/actor.js
@@ -798,11 +798,13 @@ export const addWebhook = async ({ eventTypes, requestUrl }) => {
}
return apifyClient.webhooks.createWebhook({
- isAdHoc: true,
- eventTypes,
- condition: {
- actorRunId: runId,
+ webhook: {
+ isAdHoc: true,
+ eventTypes,
+ condition: {
+ actorRunId: runId,
+ },
+ requestUrl,
},
- requestUrl,
});
};
diff --git a/test/actor.js b/test/actor.js
index e2f510a12..3aee11d90 100644
--- a/test/actor.js
+++ b/test/actor.js
@@ -1153,15 +1153,17 @@ describe('Apify.addWebhook()', () => {
const webhooksMock = sinon.mock(Apify.client.webhooks);
+ const webhook = {
+ isAdHoc: true,
+ eventTypes: expectedEventTypes,
+ condition: {
+ actorRunId: runId,
+ },
+ requestUrl: expectedRequestUrl,
+ };
+
webhooksMock.expects('createWebhook')
- .withExactArgs({
- isAdHoc: true,
- eventTypes: expectedEventTypes,
- condition: {
- actorRunId: runId,
- },
- requestUrl: expectedRequestUrl,
- })
+ .withExactArgs({ webhook })
.once()
.returns(Promise.resolve());