{"id":15714454,"url":"https://github.com/ebrassell/slashbot","last_synced_at":"2025-05-12T21:26:57.512Z","repository":{"id":46312347,"uuid":"415743112","full_name":"ebrassell/slashbot","owner":"ebrassell","description":"A python library for creating Slack slash commands using AWS Lambda Functions","archived":false,"fork":false,"pushed_at":"2021-10-31T18:37:22.000Z","size":155,"stargazers_count":17,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-11T04:47:02.404Z","etag":null,"topics":["aws-lambda","chatops","python","serverless","slack","slackbot"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ebrassell.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-11T01:31:27.000Z","updated_at":"2024-08-07T21:25:17.000Z","dependencies_parsed_at":"2022-09-13T07:02:11.200Z","dependency_job_id":null,"html_url":"https://github.com/ebrassell/slashbot","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/ebrassell%2Fslashbot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ebrassell%2Fslashbot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ebrassell%2Fslashbot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ebrassell%2Fslashbot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ebrassell","download_url":"https://codeload.github.com/ebrassell/slashbot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249942120,"owners_count":21348967,"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":["aws-lambda","chatops","python","serverless","slack","slackbot"],"created_at":"2024-10-03T21:37:16.123Z","updated_at":"2025-04-20T18:31:23.660Z","avatar_url":"https://github.com/ebrassell.png","language":"Python","funding_links":[],"categories":[":hammer_and_wrench: \u0026nbsp; Libraries and SDKs"],"sub_categories":["Python"],"readme":"# slashbot\nSlashbot makes it easy to create Slack slash commands using AWS Lambda functions. These can be handy for creating a secure way to execute automated tasks, even from a mobile device. Perfect for developing \"chatops\" type applications.\n\nFeatures:\n* Uses Slack Apps API (rather than the legacy slash command API)\n* Authenticates requests following Slack recommended best practice (https://api.slack.com/authentication/verifying-requests-from-slack)\n* Supports multiple slash commands with a single bot\n* Enables limiting certain commands to specific users via a simple ACL model.\n\n## Installation\n\npip install slashbot [--target=source_directory] \n(the --target option is used to include your packages in your source folder so they willl be included in your AWS Lambda artifact)\n\n\n## Usage\n\n```python\nimport os\nimport time\nimport slashbot\n\n# https://api.slack.com/authentication/verifying-requests-from-slack\nslashbot.SLACK_SIGNING_SECRET = os.environ.get(\"SLACK_SIGNING_SECRET\")\n\n# Define a default response\n@slashbot.route(\"*\")\ndef default(cmd: slashbot.SlashCommand):\n    if not cmd.provided_verb: #Nothing beyond the slash command\n        return help(cmd)\n    return (\n        f\"This is a default response. `{cmd.provided_verb}` is not a recognized command. \\n\"\n        + help(cmd)\n    )\n\n\n@slashbot.route(\"help\")\n#Handlers take a SlashCommand as input and return text\ndef help(cmd: slashbot.SlashCommand):\n    return f\"Here is some helpful text\"\n\n\n@slashbot.route(\"hello\")\ndef functionnamesdontmatter(cmd: slashbot.SlashCommand):\n    return f\"Hello {cmd.user_name}\"\n\n\n# Support for multi word verbs\n@slashbot.route(\"good bye\")\ndef good_bye(cmd: slashbot.SlashCommand):\n    return f\"Good bye {cmd.user_name}\"\n\n\n# An ack is automatically sent to Slack within the required 3 seconds.\n# So your function can take up to the duration of a lambda function (15 mins) \n@slashbot.route(\"echo\")\ndef echowithdelay(cmd):\n    time.sleep(300)\n    return f\"Echo {' '.join(cmd.command_args)}\"\n\n\n# acl can be optionally provided (acl can be single user name or array of user names)\n@slashbot.route(\"secure stuff\", acl=\"anybodybutme\")\ndef secure_stuff(_):\n    ...\n    # do some scary stuff limited to specific users\n    return \"\"\n\n\ndef handler(event, context):\n    return slashbot.main(event, context)\n\n```\n\u003cimg src=\"images/convo.png\" width=400\u003e\n\n\n## Todo\n\n* Add CD (push to PyPI)\n* Validation on routes to detect conflicting/duplicate entries\n* Slack APP Manifest\n* Terraform Example\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Febrassell%2Fslashbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Febrassell%2Fslashbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Febrassell%2Fslashbot/lists"}