{"id":15714317,"url":"https://github.com/yukinagae/dify-firebase-functions-slack-bolt-sample","last_synced_at":"2026-01-25T00:02:32.476Z","repository":{"id":254569905,"uuid":"841991926","full_name":"yukinagae/dify-firebase-functions-slack-bolt-sample","owner":"yukinagae","description":"Sample project for learning Dify and deploying to Firebase Functions and Slack bolt app","archived":false,"fork":false,"pushed_at":"2024-08-24T11:25:56.000Z","size":49,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-13T18:13:47.850Z","etag":null,"topics":["dify","firebase","firebase-functions","secret-manager","slack","slack-bolt"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yukinagae.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-13T13:02:38.000Z","updated_at":"2024-12-28T14:41:14.000Z","dependencies_parsed_at":"2024-08-24T12:35:37.692Z","dependency_job_id":null,"html_url":"https://github.com/yukinagae/dify-firebase-functions-slack-bolt-sample","commit_stats":null,"previous_names":["yukinagae/dify-firebase-functions-slack-bolt-sample"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/yukinagae/dify-firebase-functions-slack-bolt-sample","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yukinagae%2Fdify-firebase-functions-slack-bolt-sample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yukinagae%2Fdify-firebase-functions-slack-bolt-sample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yukinagae%2Fdify-firebase-functions-slack-bolt-sample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yukinagae%2Fdify-firebase-functions-slack-bolt-sample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yukinagae","download_url":"https://codeload.github.com/yukinagae/dify-firebase-functions-slack-bolt-sample/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yukinagae%2Fdify-firebase-functions-slack-bolt-sample/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28739321,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-24T22:12:27.248Z","status":"ssl_error","status_checked_at":"2026-01-24T22:12:10.529Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dify","firebase","firebase-functions","secret-manager","slack","slack-bolt"],"created_at":"2024-10-03T21:36:06.786Z","updated_at":"2026-01-25T00:02:32.457Z","avatar_url":"https://github.com/yukinagae.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dify-firebase-functions-slack-bolt-sample\n\n`dify-firebase-functions-slack-bolt-sample` is a beginner-friendly guide to using Dify, an open-source large language model (LLM) application development platform. This sample project demonstrates how to integrate Dify with a Slack Bolt app deployed on Firebase Functions.\n\n- [Requirements](#requirements)\n- [Setup](#setup)\n- [Usage](#usage)\n- [Making Changes](#making-changes)\n- [License](#license)\n\n## Requirements\n\nBefore you start, make sure you have these installed:\n\n- **Node.js** version 22 or later\n- **npm**\n- **Firebase CLI**\n- **ngrok**\n\nFor Firebase CLI installation, see the [Firebase - Firebase CLI reference](https://firebase.google.com/docs/cli).\n\nCheck your installations by running:\n\n```bash\n$ node --version # the below version is on my environment\nv22.4.1\n$ npm --version # the below version is on my environment\n10.7.0\n$ firebase --version # the below version is on my environment\n13.13.0\n$ ngrok --version # the below version is on my environment\nngrok version 3.3.0\n```\n\n**Important**: Ensure all subsequent commands are executed within the `functions` directory. To navigate to this directory, use the command `cd functions` and verify your current working directory if necessary.\n\n## Setup\n\nInstall Project Dependencies: Open your terminal, navigate to this project's `functions` folder, and run:\n\n```bash\n$ npm install\n```\n\n## Usage\n\n### Setup Your Firebase Project\n\nBefore deploying your application, complete the following preparatory steps:\n\n1. **Create a Firebase project**:\n\nNavigate to the Firebase Console. Click on `Create a project` and follow the prompts to create a new Firebase project.\n\n2. **Switch to the Blaze plan**:\n\nFirebase Functions require the `Blaze (Pay as you go) plan` for deployment. In the Firebase Console, select your project, then navigate to the left side bar section to change your plan.\n\n3. **Configure your Firebase project locally**:\n\nUpdate the `.firebaserc` file in your project's root directory to include your Firebase project name:\n\n```json\n{\n  \"projects\": {\n    \"default\": \"your_project_name\"\n  }\n}\n```\n\n### Setup Your Slack App\n\n1. Navigate to [Slack - Your Apps](https://api.slack.com/apps) and click `Create New App`.\n2. Choose `From an app manifest` option, select a workspace under `Pick a workspace to develop your app`, and then click `Next`.\n3. In the app manifest JSON below, replace `[your_app_name]` with your app's name, paste the updated JSON, then proceed by clicking `Next` and `Create`.\n\n```json\n{\n  \"display_information\": {\n    \"name\": \"[your_app_name]\"\n  },\n  \"features\": {\n    \"bot_user\": {\n      \"display_name\": \"[your_app_name]\",\n      \"always_online\": true\n    }\n  },\n  \"oauth_config\": {\n    \"scopes\": {\n      \"bot\": [\n        \"app_mentions:read\",\n        \"channels:history\",\n        \"chat:write\",\n        \"files:read\"\n      ]\n    }\n  },\n  \"settings\": {\n    \"event_subscriptions\": {\n      \"request_url\": \"http://dummy/events\", // NOTE: replace this later\n      \"bot_events\": [\"app_mention\"]\n    },\n    \"org_deploy_enabled\": false,\n    \"socket_mode_enabled\": false,\n    \"token_rotation_enabled\": false\n  }\n}\n```\n\n4. Navigate to `Settings` and select `Install App`, then click `Install to Workspace` and `Allow` button.\n5. Your `Bot User OAuth Token` will appear. This is your `SLACK_BOT_TOKEN` for later use.\n6. Find your `Signing Secret` under `Basic Information`. This is your `SLACK_SIGNING_SECRET` for later use.\n7. To add your bot to a Slack channel, use the command:\n\n```bash\n/invite @[your_app_name]\n```\n\n### Local Emulator\n\nTo facilitate local development and testing of Firebase Functions, use the Firebase Emulator Suite. Follow these steps to run your functions locally:\n\nTo run Firebase Functions locally using the emulator, set your secret values in `functions/.secret.local`:\n\n```bash\n$ cp -p ./.secret.local.example ./secret.local\n$ vim ./secret.local # replace the secrets with your own values\nDIFY_API_KEY=your_api_key\nSLACK_BOT_TOKEN=your_bot_token\nSLACK_SIGNING_SECRET=your_signing_secret\n```\n\nTo launch the emulator, execute:\n\n```bash\n$ npm run emulator\n✔  functions[us-central1-slack]: http function initialized (http://127.0.0.1:5001/[your_project_name]/us-central1/slack).\n```\n\nTo make your local emulator accessible online, use ngrok to forward port `5001`:\n\n```bash\n$ ngrok http 5001\nForwarding https://[your_ngrok_id].ngrok-free.app -\u003e http://localhost:5001\n```\n\nThis command provides a public URL. Replace [your_ngrok_id] in the URL `https://[your_ngrok_id].ngrok-free.app` with the ID provided by ngrok.\n\nTo configure Slack event subscriptions:\n\n1. Go to the `Event Subscriptions` page on your Slack app's dashboard.\n2. In the `Request URL` field, enter `https://[your_ngrok_id].ngrok-free.app/[your_project_name]/us-central1/slack/events`.\n3. Wait for the `Request URL Verified` confirmation, then click the `Save changes` button.\n\nTo test in a Slack channel, mention your bot using `@[your_app_name]` followed by a greeting message, like so:\n\n```bash\n@[your_app_name] hello\n```\n\n### Deploy\n\nTo authenticate with Firebase and access your projects, use the Firebase CLI login command:\n\n```bash\n$ firebase login\n```\n\nTo keep your secret keys safe when using Firebase Functions, store then as secret values in Google Cloud Secret Manger:\n\n```bash\n$ firebase functions:secrets:set DIFY_API_KEY\n? Enter a value for DIFY_API_KEY [input is hidden]\n$ firebase functions:secrets:set SLACK_BOT_TOKEN\n? Enter a value for SLACK_BOT_TOKEN [input is hidden]\n$ firebase functions:secrets:set SLACK_SIGNING_SECRET\n? Enter a value for SLACK_SIGNING_SECRET [input is hidden]\n```\n\nTo confirm your secret keys are correctly stored as secrets, use the following command:\n\n```bash\n$ firebase functions:secrets:access DIFY_API_KEY\nyour_api_key\n$ firebase functions:secrets:access SLACK_BOT_TOKEN\nyour_bot_token\n$ firebase functions:secrets:access SLACK_SIGNING_SECRET\nyour_signing_secret\n```\n\nAfter securing your secret keys, you're ready to deploy your application to Firebase Functions:\n\n```bash\n$ npm run deploy\n```\n\nTo monitor the behavior and troubleshoot your deployed functions, view the logs:\n\n```bash\n$ npm run logs\n```\n\nThe final step involves linking your deployed function to the Slack app for integration.\n\nTo configure Slack event subscriptions:\n\n1. Go to the `Event Subscriptions` page on your Slack app's dashboard.\n2. In the `Request URL` field, enter `https://slack-[your_function_id]-uc.a.run.app/events`.\n3. Wait for the `Request URL Verified` confirmation, then click the `Save changes` button.\n\nNOTE: Replace `[your_function_id]` with your Firebase project value, found in the Firebase Console under the Functions Dashboard.\n\nTo test in a Slack channel, mention your bot using `@[your_app_name]` followed by a greeting message, like so:\n\n```bash\n@[your_app_name] hello\n```\n\n## Making Changes\n\n### Building the Project\n\nAfter making changes, you might need to build the project to see your changes in action:\n\n```bash\n$ npm run build\n```\n\n### Formatting and Linting\n\nTo ensure your code follows the project's coding standards, run the formatting and linting tools:\n\n```bash\n$ npm run typecheck # type check without modifying files\n$ npm run check     # scan without modifying files\n$ npm run fix       # modify files\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyukinagae%2Fdify-firebase-functions-slack-bolt-sample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyukinagae%2Fdify-firebase-functions-slack-bolt-sample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyukinagae%2Fdify-firebase-functions-slack-bolt-sample/lists"}