You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: Actor ID is not in settings anymore (apify#1850)
Fixapify#1849, thanks for the
report, @JMatej! This is more of a hotfix, not a rewrite of the whole
article. I didn't aim for perfection and better stylistics, I just
wanted to fix the most glaring issues which get people stuck. I did run
`apify create` and `apify push` locally to verify the workflow, but I
didn't test anything else, webhooks, API calls, etc.
In this lesson we'll be writing a new Actor and integrating it with our beloved Amazon scraping Actor. First, we'll navigate to the same directory where our **demo-actor** folder lives, and run `apify create filter-actor`_(once again, you can name the Actor whatever you want, but for this lesson, we'll be calling the new Actor **filter-actor**)_. When prompted for which type of boilerplate to start out with, select **Empty**.
14
+
In this lesson we'll be writing a new Actor and integrating it with our beloved Amazon scraping Actor. First, we'll navigate to the same directory where our **demo-actor** folder lives, and run `apify create filter-actor`_(once again, you can name the Actor whatever you want, but for this lesson, we'll be calling the new Actor **filter-actor**)_. When prompted about the programming language, select **JavaScript**:
15
15
16
-

16
+
```text
17
+
$ apify create filter-actor
18
+
? Choose the programming language of your new Actor:
19
+
❯ JavaScript
20
+
TypeScript
21
+
Python
22
+
```
17
23
18
-
Cool! Now, we're ready to get started.
24
+
Then use the arrow down key to select **Empty JavaScript Project**:
25
+
26
+
```text
27
+
$ apify create filter-actor
28
+
✔ Choose the programming language of your new Actor: JavaScript
29
+
? Choose a template for your new Actor. Detailed information about the template will be shown in the next step.
30
+
Crawlee + Playwright + Chrome
31
+
Crawlee + Playwright + Camoufox
32
+
Bootstrap CheerioCrawler
33
+
Cypress
34
+
❯ Empty JavaScript Project
35
+
Standby JavaScript Project
36
+
...
37
+
```
38
+
39
+
As a last step, confirm the choices by **Install template** and wait until our new Actor is ready.
19
40
20
41
## Building the new Actor {#building-the-new-actor}
> Tip: You will need to use `forceCloud` option - `Actor.openDataset(<name/id>, { forceCloud: true });` - to open dataset from platform storage while running Actor locally.
64
+
:::tip Accessing Cloud Datasets Locally
65
+
66
+
You will need to use `forceCloud` option - `Actor.openDataset(<name/id>, { forceCloud: true });` - to open dataset from platform storage while running Actor locally.
67
+
68
+
:::
44
69
45
70
Next, we'll grab hold of the dataset's items with the `dataset.getData()` function:
46
71
@@ -121,15 +146,36 @@ Cool! But **wait**, don't forget to configure the **INPUT_SCHEMA.json** file as
121
146
}
122
147
```
123
148
124
-
Now we're done, and we can push it up to the Apify platform with the `apify push` command.
149
+
Now we're done, and we can push it up to the Apify platform with the `apify push` command:
150
+
151
+
```text
152
+
$ apify push
153
+
Info: Created Actor with name filter-actor on Apify.
154
+
Info: Deploying Actor 'filter-actor' to Apify.
155
+
Run: Updated version 0.0for Actor filter-actor.
156
+
Run: Building Actor filter-actor
157
+
(timestamp) ACTOR: Extracting Actor documentation from README.md
158
+
(timestamp) ACTOR: Building Docker image.
159
+
...
160
+
(timestamp) ACTOR: Pushing Docker image to repository.
161
+
(timestamp) ACTOR: Build finished.
162
+
Actor build detail https://console.apify.com/actors/Yk1bieximsduYDydP#/builds/0.0.1
163
+
Actor detail https://console.apify.com/actors/Yk1bieximsduYDydP
164
+
Success: Actor was deployed to Apify cloud and built there.
165
+
```
125
166
126
167
## Setting up the webhook {#setting-up-the-webhook}
127
168
128
-
Since we'll be calling the Actor via the [Apify API](/academy/api/run-actor-and-retrieve-data-via-api), we'll need to grab hold of the ID of the Actor we just created and pushed to the platform. The ID is always accessible through the **Settings** page of the Actor.
169
+
We'll use the [Apify API](/academy/api/run-actor-and-retrieve-data-via-api) to set up the webhook. To compose the HTTP request, we'll need either the ID of our Actor or its technical name. Let's take a second look at the end of the output of the `apify push` command:
129
170
130
-

171
+
```text
172
+
...
173
+
Actor build detail https://console.apify.com/actors/Yk1bieximsduYDydP#/builds/0.0.1
174
+
Actor detail https://console.apify.com/actors/Yk1bieximsduYDydP
175
+
Success: Actor was deployed to Apify cloud and built there.
176
+
```
131
177
132
-
With this `actorId`, and our `token`, which is retrievable through **Settings > Integrations** on the Apify Console, we can construct a link which will call the Actor:
178
+
The URLs tell us that our Actor's ID is `Yk1bieximsduYDydP`. With this `actorId`, and our `token`, which is retrievable through **Settings > Integrations** on the Apify Console, we can construct a link which will call the Actor:
Since we need to create another Actor, we'll once again use the `apify create` command and start from an empty template.
15
-
16
-

14
+
Since we need to create another Actor, we'll once again use the `apify create` command and start from an empty template. This time, let's call our project **actor-caller**:
15
+
16
+
```text
17
+
$ apify create filter-caller
18
+
? Choose the programming language of your new Actor:
19
+
❯ JavaScript
20
+
TypeScript
21
+
Python
22
+
```
17
23
18
-
This time, let's call our project **actor-caller**.
24
+
Again, use the arrow down key to select **Empty JavaScript Project**:
25
+
26
+
```text
27
+
$ apify create filter-actor
28
+
✔ Choose the programming language of your new Actor: JavaScript
29
+
? Choose a template for your new Actor. Detailed information about the template will be shown in the next step.
30
+
Crawlee + Playwright + Chrome
31
+
Crawlee + Playwright + Camoufox
32
+
Bootstrap CheerioCrawler
33
+
Cypress
34
+
❯ Empty JavaScript Project
35
+
Standby JavaScript Project
36
+
...
37
+
```
19
38
20
-
Let's also set up some boilerplate, grabbing our inputs and creating a constant variable for the task:
39
+
Confirm the choices by **Install template** and wait until our new Actor is ready. Now let's also set up some boilerplate, grabbing our inputs and creating a constant variable for the task:
0 commit comments