{"id":23338402,"url":"https://github.com/abhirockzz/fn-slack-bot-sample","last_synced_at":"2025-08-08T02:42:09.032Z","repository":{"id":79124991,"uuid":"145121791","full_name":"abhirockzz/fn-slack-bot-sample","owner":"abhirockzz","description":"(TEMPORARILY DEPRECATED) Fn function as a Slack Bot","archived":false,"fork":false,"pushed_at":"2018-08-17T13:39:22.000Z","size":502,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-13T16:32:41.160Z","etag":null,"topics":["faas","fnproject","functions","serverless"],"latest_commit_sha":null,"homepage":"","language":"Java","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/abhirockzz.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":"2018-08-17T13:09:00.000Z","updated_at":"2019-01-08T06:37:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"26f521b2-99aa-4d95-8fa9-22353badc018","html_url":"https://github.com/abhirockzz/fn-slack-bot-sample","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abhirockzz%2Ffn-slack-bot-sample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abhirockzz%2Ffn-slack-bot-sample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abhirockzz%2Ffn-slack-bot-sample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abhirockzz%2Ffn-slack-bot-sample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abhirockzz","download_url":"https://codeload.github.com/abhirockzz/fn-slack-bot-sample/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247666003,"owners_count":20975785,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["faas","fnproject","functions","serverless"],"created_at":"2024-12-21T03:13:49.166Z","updated_at":"2025-04-07T13:43:49.475Z","avatar_url":"https://github.com/abhirockzz.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fn Slack Bot\r\n\r\nFn functions to implement a simple [Slack Bot](https://api.slack.com/bot-users)\r\n\r\n## step 0\r\n\r\n- `git clone https://github.com/abhirockzz/fn-slack-bot-sample`\r\n- make sure you have Fn installed on an infra which can be accessed from public internet (e.g. VM), or use [ngrok](https://api.slack.com/tutorials/tunneling-with-ngrok) on your local machine\r\n\r\n## Handle slack verification challenge function\r\n\r\nStart Fn server - `fn start`\r\n\r\nFrom a different terminal, configure Docker\r\n\r\n- `docker login` (use your docker registry credentials)\r\n- `export FN_REGISTRY=\u003cdocker repository\u003e`\r\n\r\ndeploy the function to respond to slack verification challenge\r\n\r\n- `cd slack-verification-challenge-handler`\r\n- `fn -v deploy --app fnbot`\r\n\r\n\u003e the public URL for the function should be `http://your_ip:port/r/fnbot/service` (`fnbot` is the app name which `service` is the path)\r\n\r\n## Slack config\r\n\r\nSign into your [Slack workspace](https://slack.com/signin) - if you don't have one, [please create it](https://slack.com/create)\r\n\r\nBefore you start, you'll need a Slack App - [click here](https://api.slack.com/apps/new) to get started\r\n\r\n![](images/create-slack-app.jpg)\r\n\r\n\r\nTo use your Slack App as a bot, first you'll need to create a Bot User for it - refer to section **1. Creating a bot user** on [this page](https://api.slack.com/bot-users)\r\n\r\n![](images/add-bot-user.jpg)\r\n\r\n\r\nSetup the Events API for your bot. Refer to section **2. Setting up the Events API** on [this page](https://api.slack.com/bot-users)\r\n\r\n- In the Request URL, enter your function endpoint (as mentioned above)\r\n\r\n![](images/request-URL-config.jpg)\r\n\r\n- Subscribe to the `app_mention` Bot Event (the Fn bot function is designed to handle this event)\r\n\r\n![](images/bot-event-subscription.jpg)\r\n\r\nFor the next steps, refer section **3. Installing the bot to a workspace** on [this page](https://api.slack.com/bot-users)\r\n\r\n- Install the bot to your workspace\r\n\r\n![](images/install-app.jpg)\r\n\r\n- Store the **Bot User OAuth Access Token** for later use \r\n\r\n![](images/bot-oauth-token.jpg)\r\n\r\n- from the **Basic Information** section in your app settings page, scroll down and make a note of the verification token\r\n\r\n![](images/verification-token.jpg)\r\n\r\n## Deploy the bot function\r\n\r\n- `cd slack-app-mention-event-handler`\r\n- update the `SLACK_VERIFICATION_TOKEN` and `SLACK_BOT_OAUTH_TOKEN` in the `config` section in `func.yaml` with the values you saved in the previous step\r\n- deploy the function - `fn -v deploy --app fnbot`. Note that this will override the challenge verification function because\r\n\t- challenge verification is a `one-time` process and \r\n\t- once you configure the request URL, Slack will send all your subscribed events to the same endpoint/URL i.e. you cannot change it\r\n\r\n## Have fun with Fn Bot !\r\n\r\nThe bot itself is super simple (a.k.a dumb). It responds to your mention by returning a message with the current date - not ground breaking, but it works!\r\n\r\n\r\nHead over to your Slack workspace and simple mention your bot (by its name) e.g. `@testbot`\r\n\r\n![](images/bot-test.jpg)\r\n\r\nI told you, it's dumb.. no matter what you throw at it !\r\n\r\n## Fn Concepts\r\n\r\nTODO details\r\n\r\n- uses `async` function\r\n- simple JSON to POJO data bindings\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabhirockzz%2Ffn-slack-bot-sample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabhirockzz%2Ffn-slack-bot-sample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabhirockzz%2Ffn-slack-bot-sample/lists"}