Content-Length: 266714 | pFad | http://github.com/slack-samples/deno-code-snippets/tree/main/Scheduled_Triggers

6D deno-code-snippets/Scheduled_Triggers at main · slack-samples/deno-code-snippets · GitHub
Skip to content

Latest commit

 

History

History

Scheduled_Triggers

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Scheduled Triggers

This sub-app guides you on invoking a workflow using a scheduled trigger. A scheduled trigger can invoke a workflow periodically or only once. The supported intervals as of this writing are "once", "hourly", "daily", "weekly", "monthly", and "yearly".

If you haven't set up the Slack CLI and the project on your local machine yet, visit the top-level guide document first.

Supported Workflows

  • Scheduled Workflow: Do nothing apart from Slack server-side logging

Scheduled Workflow

To create a scheduled trigger for the workflow in this template, run the following command:

$ slack trigger create --trigger-def ./Scheduled_Triggers/triggers/scheduled_only_once.ts

After selecting a Workspace, the trigger should be created successfully.

The sample workflow will be invoked in 5 seconds, but it actually does nothing. To confirm that the workflow is invoked for sure, run the following command to check Slack's server-side logs in your termninal.

$ slack activity -t

You will see a few lines of logs like this:

2023-01-20 10:17:06 [info] [Fn04KS1D0335] (Trace=Tr04KUKQDD0U) Function execution started for workflow function 'Scheduled Workflow'
2023-01-20 10:17:06 [info] [Wf04KUJK493N] (Trace=Tr04KP7MHUPP) Execution started for workflow 'Scheduled Workflow'
2023-01-20 10:17:07 [info] [Fn04KS1D0335] (Trace=Tr04KUKQDD0U) Function execution completed for function 'Scheduled Workflow'
2023-01-20 10:17:07 [info] [Wf04KUJK493N] (Trace=Tr04KP7MHUPP) Execution completed for workflow 'Scheduled Workflow'

Deploying Your App

Once you're done with development, you can deploy the production version of your app to Slack hosting using slack deploy:

$ slack deploy

After deploying, create a trigger for the production version of your app (not appended with (local)). Once the trigger is invoked, the workflow should run just as it did when developing locally.

Project Structure

manifest.ts

The app manifest contains the app's configuration. This file defines attributes like app name and description.

slack.json

Used by the CLI to interact with the project's SDK dependencies. It contains script hooks that are executed by the CLI and implemented by the SDK.

Scheduled_Triggers/workflows

A workflow is a set of steps that are executed in order. Each step in a workflow is a function.

Workflows can be configured to run without user input, or they can collect inputs by beginning with a form before continuing to the next step.

Scheduled_Triggers/triggers

Triggers determine when workflows are executed. A trigger file describes a scenario in which a workflow should be run, such as a user pressing a button or when a specific event occurs.

What's Next?

The do_nothing workflow does nothing as its name implies. To learn how to build more meaningful workflows, please check out the following sample workflows. The workflows can be invoked every day to maintain some data.

To learn more about other samples, visit the top-level guide to find more!









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/slack-samples/deno-code-snippets/tree/main/Scheduled_Triggers

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy