Skip to content

Commit 8b8f024

Browse files
committed
updates
1 parent 9b61d71 commit 8b8f024

File tree

2 files changed

+34
-6
lines changed

2 files changed

+34
-6
lines changed

components/apify/actions/run-actor/run-actor.mjs

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* eslint-disable no-unused-vars */
22
import apify from "../../apify.app.mjs";
33
import { parseObject } from "../../common/utils.mjs";
4+
import { EVENT_TYPES } from "../../common/constants.mjs";
45

56
export default {
67
key: "apify-run-actor",
@@ -56,11 +57,12 @@ export default {
5657
description: "Specifies the maximum cost of the Actor run. This parameter is useful for pay-per-event Actors, as it allows you to limit the amount charged to your subscription. You can access the maximum cost in your Actor by using the ACTOR_MAX_TOTAL_CHARGE_USD environment variable.",
5758
optional: true,
5859
},
59-
webhooks: {
60+
webhook: {
6061
type: "string",
61-
label: "Webhooks",
62-
description: "Specifies optional webhooks associated with the Actor run, which can be used to receive a notification e.g. when the Actor finished or failed. The value is a Base64-encoded JSON array of objects defining the webhooks. For more information, see [Webhooks documentation](https://docs.apify.com/platform/integrations/webhooks).",
62+
label: "Webhook",
63+
description: "Specifies optional webhook associated with the Actor run, which can be used to receive a notification e.g. when the Actor finished or failed.",
6364
optional: true,
65+
reloadProps: true,
6466
},
6567
},
6668
methods: {
@@ -179,6 +181,14 @@ export default {
179181
};
180182
}
181183
}
184+
if (this.webhook) {
185+
props.eventTypes = {
186+
type: "string[]",
187+
label: "Event Types",
188+
description: "The types of events to send to the webhook",
189+
options: EVENT_TYPES,
190+
};
191+
}
182192
return props;
183193
},
184194
async run({ $ }) {
@@ -199,7 +209,8 @@ export default {
199209
maxItems,
200210
maxTotalChargeUsd,
201211
waitForFinish,
202-
webhooks,
212+
webhook,
213+
eventTypes,
203214
...data
204215
} = this;
205216

@@ -219,10 +230,18 @@ export default {
219230
maxItems,
220231
maxTotalChargeUsd,
221232
waitForFinish,
222-
webhooks,
233+
webhooks: webhook
234+
? {
235+
eventTypes,
236+
requestUrl: webhook,
237+
}
238+
: undefined,
223239
},
224240
});
225-
$.export("$summary", `Successfully started actor run with ID: ${response.data.id}`);
241+
const summary = this.runAsynchronously
242+
? `Successfully started actor run with ID: ${response.data.id}`
243+
: `Successfully ran actor with ID: ${this.actorId}`;
244+
$.export("$summary", `${summary}`);
226245
return response;
227246
},
228247
};
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,11 @@
11
export const ACTOR_ID = "aYG0l9s7dbB7j3gbS";
22
export const LIMIT = 100;
3+
4+
export const EVENT_TYPES = [
5+
"ACTOR.RUN.CREATED",
6+
"ACTOR.RUN.SUCCEEDED",
7+
"ACTOR.RUN.FAILED",
8+
"ACTOR.RUN.ABORTED",
9+
"ACTOR.RUN.TIMED_OUT",
10+
"ACTOR.RUN.RESURRECTED",
11+
];

0 commit comments

Comments
 (0)