Skip to content

Commit 05a635a

Browse files
committed
finish CLI starter
1 parent 7654b8c commit 05a635a

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/content/docs/workflows/get-started/cli-quick-start.mdx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ To learn more about Workflows, read [the beta announcement blog](https://blog.cl
1919

2020
Workflows allow you to build durable, multi-step applications using the Workers platform. A Workflow can automatically retry, persist state, run for hours or days, and coordinate between third-party APIs.
2121

22-
You can build Workflows to post-process file uploads to [R2 object storage](/r2/), automate generation of [Workers AI](/workers-ai/) embeddings into a [Vectorize](/vectorize/) vector database, or to trigger [user lifecycle emails](TODO) using your favorite email API.
22+
You can build Workflows to post-process file uploads to [R2 object storage](/r2/), automate generation of [Workers AI](/workers-ai/) embeddings into a [Vectorize](/vectorize/) vector database, or to trigger user lifecycle emails using your favorite email API.
2323

2424
## Prerequisites
2525

@@ -150,14 +150,11 @@ Specifically, the code above:
150150

151151
## 2. Deploy a Workflow
152152

153-
Workflows are deployed via [`wrangler](/workers/wrangler/install-and-update/), which is installed when you first ran `npm create cloudflare`, above. Workflows are Workers scripts, and deployed the same way.
153+
Workflows are deployed via [`wrangler](/workers/wrangler/install-and-update/), which is installed when you first ran `npm create cloudflare`, above. Workflows are Workers scripts, and deployed the same way:
154154

155155
```sh
156156
npx wrangler@latest deploy
157157
```
158-
```sh output
159-
TODO
160-
```
161158

162159
## 3. Running a Workflow
163160

@@ -174,7 +171,9 @@ Refer to the [events and parameters documentation](/workflows/build/events-and-p
174171

175172
### Worker binding
176173

177-
TODO - trigger from a Worker
174+
You can [bind to a Workflow](/workers/runtime-apis/bindings/#what-is-a-binding) from any handler in a Workers script, allowing you to programatically trigger and pass parameters to a Workflow instance from your own application code.
175+
176+
To bind a Workflow to a Worker, you need to define a `[[workflows]]` binding in your `wrangler.toml` configuration:
178177

179178
```toml title="wrangler.toml"
180179
[[workflows]]
@@ -189,10 +188,10 @@ class_name = "MyWorkflow"
189188
script_name = "workflows-starter"
190189
```
191190

192-
You can then invoke the methods on this binding directly from your Worker script. The `Workflow` type has methods for:
191+
You can then invoke the methods on this binding directly from your Worker script's `env` parameter. The `Workflow` type has methods for:
193192

194193
* `create()` - creating (triggering) a new instance of the Workflow, returning the ID.
195-
* `get(id)`- retrieve a Workflow instance by ID
194+
* `getByName()`- retrieve a Workflow instance by name (or `getById` by ID)
196195
* `status()` - get the current status of a unique Workflow instance.
197196

198197
For example, the following Worker will fetch the status of an existing Workflow instance by ID (if supplied), else it will create a new Workflow instance and return its ID:

0 commit comments

Comments
 (0)