Giter Site home page Giter Site logo

bolt-js-custom-function-template's Introduction

Bolt for JavaScript Custom Function Template

This is a Bolt for JavaScript template app used to build custom functions in Workflow Builder.

Setup

Before getting started, first make sure you have a development workspace where you have permission to install apps. Please note that the features in this project require that the workspace be part of a Slack paid plan.

Install the Slack CLI

To use this template, you need to install and configure the Slack CLI. Step-by-step instructions can be found in our Quickstart Guide.

Clone the Template

Start by cloning this repository:

# Clone this project onto your machine
$ slack create my-app -t slack-samples/bolt-js-custom-function-template

# Change into the project directory
$ cd my-app

Running Your Project Locally

While building your app, you can see your changes appear in your workspace in real-time with slack run. You'll know an app is the development version if the name has the string (local) appended.

# Run app locally
$ slack run

⚡️ Bolt app is running! ⚡️

To stop running locally, press <CTRL> + C to end the process.

Linting

Run ESLint for code formatting and linting:

$ npm run lint

Using Functions in Workflow Builder

With your server running, your function is now ready for use in Workflow Builder! Add it as a custom step in a new or existing workflow, then run the workflow while your app is running.

For more information on creating workflows and adding custom steps, read more here.

Project Structure

.slack/

Contains apps.dev.json and config.json, which include installation details for your project.

app.js

app.js is the entry point for the application and is the file you'll run to start the server. This project aims to keep this file as thin as possible, primarily using it as a way to route inbound requests.

manifest.json

manifest.json is a configuration for Slack apps. With a manifest, you can create an app with a pre-defined configuration, or adjust the configuration of an existing app.

slack.json

Used by the Slack CLI to interact with the project's SDK dependencies. It contains script hooks that are executed by the CLI and implemented by @slack/cli-hooks.

bolt-js-custom-function-template's People

Contributors

dependabot[bot] avatar misscoded avatar zimeg avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

bolt-js-custom-function-template's Issues

Custom Function Sample fails

Using slack create as indicated in the tutorial, this function fails out of the box with:

2024-03-03 12:59:22 [error] [Fn06NBFUQXFA] (Trace=Tr06MG3ASL2J) Function 'Sample function' (app function) failed
	event_dispatch_failed
2024-03-03 12:59:22 [error] [Wf06MN96G71R] (Trace=Tr06MG3ASL2J) Workflow step 'Sample function' failed

Would really love to use this feature, please fix!

Slack CLI fails to detect NodeJS

When executing the command slack create -t slack-samples/bolt-python-custom-function-template my-app the script exists with Error code 1.
Following this, slack run will fail due to missing dependencies.

manually running npm install will then allow slack run to function as expected.

DEBUG 2024/04/26 13:15:44.608327 unsupported runtime found: Failed to detect project runtime from directory structure (runtime_not_supported)
INFO 2024/04/26 13:15:44.609069 ------------------------------------
INFO 2024/04/26 13:15:44.609069 Operating System (OS): [windows]
INFO 2024/04/26 13:15:44.609069 Command: [...\AppData\Local\slack-cli\bin\slack.exe create -t slack-samples/bolt-js-custom-function-template my-app]
INFO 2024/04/26 13:15:44.609069 SessionID: [4d4d0501-3ce1-43a0-b427-fd646701dc4c]
INFO 2024/04/26 13:15:44.609069 Slack-CLI-TraceID: [03db4d6df3e9653c]
INFO 2024/04/26 13:15:44.609069 Slack-CLI Version: [2.22.0]
INFO 2024/04/26 13:15:44.609069 System ID: [7ae7b819-7d42-4f5e-abe8-8334952a6806]
DEBUG 2024/04/26 13:15:45.298330 "check-update" hook value not found in slack.json when checking for SDK updates
DEBUG 2024/04/26 13:15:45.912177 initialize runtime from auto-detect: Node.js (nodejs)
DEBUG 2024/04/26 13:15:51.613169 Starting root command cleanup routine
ERROR 2024/04/26 13:15:51.615717 exit status 1�[1;38;5;178m�[0m

DEBUG 2024/04/26 13:15:51.617824 FlushToLogstash will POST https://slackb.com/events/cli payload: [{"context":{"bin":"...\\AppData\\Local\\slack-cli\\bin\\slack.exe","cli_version":"2.22.0","command":"create","command_canonical":"create","flags":["template"],"host":"5f0284b18d67b7109adf65bb5de494643a3a0bb7","os":"windows","project_id":"d6509782-0a94-4375-ac3b-2c0d9dcd5a0f","session_id":"4d4d0501-3ce1-43a0-b427-fd646701dc4c","system_id":"7ae7b819-7d42-4f5e-abe8-8334952a6806"},"data":{"app":{"template":"slack-samples/bolt-js-custom-function-template"},"auth":{},"error_code":"app_create_error","error_msg":"exit status 1\n"},"event":"error","timestamp":1714101351616}]
DEBUG 2024/04/26 13:15:51.848699 FlushToLogstash response status code: 200, body: ok

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.