René's URL Explorer Experiment


Title: I would like to refer to X-Slack-Retry-Num. · Issue #731 · slackapi/bolt-python · GitHub

Open Graph Title: I would like to refer to X-Slack-Retry-Num. · Issue #731 · slackapi/bolt-python

X Title: I would like to refer to X-Slack-Retry-Num. · Issue #731 · slackapi/bolt-python

Description: I want to deploy a Slack bolt using Cloud Function, but since I can't use lazy listener, I use Thread for parallel processing. When I deploy to Cloud Function with the following code, I get duplicate messages the first time. After that, ...

Open Graph Description: I want to deploy a Slack bolt using Cloud Function, but since I can't use lazy listener, I use Thread for parallel processing. When I deploy to Cloud Function with the following code, I get duplica...

X Description: I want to deploy a Slack bolt using Cloud Function, but since I can't use lazy listener, I use Thread for parallel processing. When I deploy to Cloud Function with the following code, I get dup...

Opengraph URL: https://github.com/slackapi/bolt-python/issues/731

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"I would like to refer to X-Slack-Retry-Num.","articleBody":"I want to deploy a Slack bolt using Cloud Function, but since I can't use lazy listener, I use **Thread** for parallel processing. When I deploy to Cloud Function with the following code, I get duplicate messages the first time. After that, it only needs to be done once. However, after some time passes, duplicate messages are sent again.\r\n Therefore, **I would like to implement a process that only returns a response if there is an X-Slack-Retry-Num in the header**, but I do not know how to get the header. \r\nI implemented the following code in Python this way,\r\n\r\n```Python\r\n    if \"X-Slack-Retry-Num\" in event[\"headers\"]:\r\n        return {'statusCode': 200, 'body': 'this request is retry'}\r\n\r\n```\r\n\r\n Ended with an error result.\r\n```\r\n    if \"X-Slack-Retry-Num\" in event[\"headers\"]:\r\nKeyError: 'headers'\r\n```\r\nPlease let me know if there is a better solution.\r\n\r\n### This is my code:\r\n\r\n```Python\r\nimport os\r\nimport logging\r\nfrom slack_bolt import App\r\nfrom slack_bolt import Say\r\nfrom slack_bolt.adapter.socket_mode import SocketModeHandler\r\nfrom slack_sdk import WebClient\r\nimport functions_framework\r\nimport deepl\r\nimport langid\r\nimport json\r\nfrom slack_bolt.adapter.flask import SlackRequestHandler\r\n\r\n\r\nlogging.basicConfig(level=logging.DEBUG)\r\n\r\nDEEPL_API_TOKEN = os.environ[\"DEEPL_API_TOKEN\"]\r\nSLACK_BOT_TOKEN = os.environ[\"SLACK_BOT_TOKEN\"]\r\n\r\napp = App(\r\n    token=SLACK_BOT_TOKEN,\r\n    signing_secret=os.environ.get(\"SLACK_SIGNING_SECRET\"),\r\n    process_before_response=True\r\n    )\r\nhandler = SlackRequestHandler(app)\r\n\r\nclient = WebClient(SLACK_BOT_TOKEN)\r\ntranslator = deepl.Translator(DEEPL_API_TOKEN)\r\n\r\n\r\n@app.middleware\r\ndef log_request(logger, body, next):\r\n    logger.debug(body)\r\n    return next()\r\n\r\n\r\n\r\n@app.event(\"reaction_added\")\r\ndef show_datepicker(event,say: Say):\r\n    reaction = event[\"reaction\"]\r\n    replies = say.client.conversations_replies(channel=event[\"item\"][\"channel\"], ts=event[\"item\"][\"ts\"])\r\n    print(\"replies is:\",replies)\r\n    message = replies[\"messages\"][0][\"text\"]\r\n    print(\"message is:\",message)\r\n    lang = langid.classify(replies[\"messages\"][0][\"text\"])\r\n    print(\"languages[0] is:\",lang[0])\r\n\r\n\r\n    if reaction == \"eyes\":\r\n        if lang[0] == \"ja\":\r\n            target_lang = \"EN-US\"\r\n        elif lang[0] == \"en\":\r\n            target_lang = \"JA\"\r\n        else:\r\n            return\r\n        result = translator.translate_text(message, target_lang=target_lang)\r\n        query = \"\"\r\n        for m in message.split(\"\\n\"):\r\n            query += f\">{m}\\n\"\r\n        say(\r\n            thread_ts=replies[\"messages\"][0].get(\"ts\"),\r\n            text=f\"{query}{result.text}\"\r\n            )           \r\n        return \r\n\r\n\r\nfrom threading import Thread\r\n\r\n@functions_framework.http\r\ndef slack_bot(request):\r\n    request_data = request.form\r\n    t = Thread(target=show_datepicker, kwargs={'request_data': request_data})\r\n    t.start()\r\n    return handler.handle(request)\r\n    \r\nif __name__ == \"__main__\":\r\n    app.start(port=int(os.environ.get(\"PORT\", 3000)))\r\n```\r\n\r\n#### The `slack_bolt` version\r\n\r\nslack-bolt==1.14.3\r\nslack-sdk==3.18.3\r\n#### Python runtime version\r\n\r\nPython 3.9.12\r\n\r\n### Expected result:\r\n\r\nI want to prevent duplicate messages.\r\n### Actual result:\r\n\r\nDuplicate messages more than three times\r\n","author":{"url":"https://github.com/iwakiri0104","@type":"Person","name":"iwakiri0104"},"datePublished":"2022-10-04T04:33:51Z","url":"https://github.com/slackapi/bolt-python/issues/731"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:b44bfd19-cce2-fcda-82d6-5cd17f845e1d
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id986C:5EE3D:31E705:40580D:6AFF879B
html-safe-noncedb25d38c8909e57777b94f60e5c2fcee1063600bce816eef9655a9ea77914fd4
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5ODZDOjVFRTNEOjMxRTcwNTo0MDU4MEQ6NkFGRjg3OUIiLCJ2aXNpdG9yX2lkIjoiNDE4ODUxNTAzODcxNTE1MjI4MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac2c5cd62aec9f18cf2cc2245459581a370e18910784bf7e87b2fadc2d4366c3ee
hovercard-subject-tagissue:1395651911
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/slackapi/bolt-python/731/issue_layout
twitter:imagehttps://opengraph.githubassets.com/97ab3457c9a50bf9e75ff7f48b82fddf306430cb27d98c0bf67675eca55da182/slackapi/bolt-python/issues/731
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/97ab3457c9a50bf9e75ff7f48b82fddf306430cb27d98c0bf67675eca55da182/slackapi/bolt-python/issues/731
og:image:altI want to deploy a Slack bolt using Cloud Function, but since I can't use lazy listener, I use Thread for parallel processing. When I deploy to Cloud Function with the following code, I get duplica...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameiwakiri0104
hostnamegithub.com
expected-hostnamegithub.com
None587ad99a3e443b2e1cb0d3df059ec49ab54389861f13310766dfdeb615fed90d
turbo-cache-controlno-preview
go-importgithub.com/slackapi/bolt-python git https://github.com/slackapi/bolt-python.git
octolytics-dimension-user_id6962987
octolytics-dimension-user_loginslackapi
octolytics-dimension-repository_id268795735
octolytics-dimension-repository_nwoslackapi/bolt-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id268795735
octolytics-dimension-repository_network_root_nwoslackapi/bolt-python
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release5bb0fb68d64881d1344f5863d809515d496801e5
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/slackapi/bolt-python/issues/731#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fslackapi%2Fbolt-python%2Fissues%2F731
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fslackapi%2Fbolt-python%2Fissues%2F731
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=slackapi%2Fbolt-python
Reloadhttps://github.com/slackapi/bolt-python/issues/731
Reloadhttps://github.com/slackapi/bolt-python/issues/731
Reloadhttps://github.com/slackapi/bolt-python/issues/731
slackapihttps://github.com/slackapi
bolt-pythonhttps://github.com/slackapi/bolt-python
Codehttps://github.com/slackapi/bolt-python
Issues28 (28)https://github.com/slackapi/bolt-python/issues
Pull requests11 (11)https://github.com/slackapi/bolt-python/pulls
Actionshttps://github.com/slackapi/bolt-python/actions
Security and qualityhttps://github.com/slackapi/bolt-python/security
Insightshttps://github.com/slackapi/bolt-python/insights
https://github.com/slackapi/bolt-python
New issuehttps://github.com/login?return_to=https://github.com/slackapi/bolt-python/issues/731
New issuehttps://github.com/login?return_to=https://github.com/slackapi/bolt-python/issues/731
I would like to refer to X-Slack-Retry-Num.https://github.com/slackapi/bolt-python/issues/731#top
questionFurther information is requestedhttps://github.com/slackapi/bolt-python/issues?q=state%3Aopen%20label%3A%22question%22
https://github.com/iwakiri0104
iwakiri0104https://github.com/iwakiri0104
on Oct 4, 2022https://github.com/slackapi/bolt-python/issues/731#issue-1395651911
seratchhttps://github.com/seratch
questionFurther information is requestedhttps://github.com/slackapi/bolt-python/issues?q=state%3Aopen%20label%3A%22question%22
on Oct 4, 2022https://github.com/slackapi/bolt-python/issues/731#event-7512753004
https://github.com/seratch
seratchhttps://github.com/seratch
on Oct 4, 2022https://github.com/slackapi/bolt-python/issues/731#issuecomment-1266392822
@iwakiri0104https://github.com/iwakiri0104
herehttps://github.com/slackapi/bolt-python/issues/693#issuecomment-1266392110
https://github.com/seratch
seratchhttps://github.com/seratch
on Oct 4, 2022https://github.com/slackapi/bolt-python/issues/731#issuecomment-1266438928
@iwakiri0104https://github.com/iwakiri0104
#693 (comment)https://github.com/slackapi/bolt-python/issues/693#issuecomment-1266428930
#732https://github.com/slackapi/bolt-python/issues/732
slackapi/java-slack-sdk#677https://github.com/slackapi/java-slack-sdk/pull/677
https://github.com/iwakiri0104
iwakiri0104https://github.com/iwakiri0104
on Oct 4, 2022https://github.com/slackapi/bolt-python/issues/731#issuecomment-1266767215
@seratchhttps://github.com/seratch
#639 commenthttps://github.com/slackapi/bolt-python/issues/693#issuecomment-1266428930
https://github.com/seratch
seratchhttps://github.com/seratch
on Oct 4, 2022https://github.com/slackapi/bolt-python/issues/731#issuecomment-1266783271
@iwakiri0104https://github.com/iwakiri0104
https://github.com/iwakiri0104
iwakiri0104https://github.com/iwakiri0104
on Oct 4, 2022https://github.com/slackapi/bolt-python/issues/731#issuecomment-1266823425
@seratchhttps://github.com/seratch
https://github.com/seratch
seratchhttps://github.com/seratch
on Oct 4, 2022https://github.com/slackapi/bolt-python/issues/731#issuecomment-1266825690
@iwakiri0104https://github.com/iwakiri0104
seratchhttps://github.com/seratch
completedhttps://github.com/slackapi/bolt-python/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Oct 4, 2022https://github.com/slackapi/bolt-python/issues/731#event-7515524153
https://github.com/eddyg
eddyghttps://github.com/eddyg
on Oct 4, 2022https://github.com/slackapi/bolt-python/issues/731#issuecomment-1267176829
https://github.com/seratch
seratchhttps://github.com/seratch
on Oct 14, 2022https://github.com/slackapi/bolt-python/issues/731#issuecomment-1278491597
@eddyghttps://github.com/eddyg
Sign up for freehttps://github.com/signup?return_to=https://github.com/slackapi/bolt-python/issues/731
Sign in to commenthttps://github.com/login?return_to=https://github.com/slackapi/bolt-python/issues/731
questionFurther information is requestedhttps://github.com/slackapi/bolt-python/issues?q=state%3Aopen%20label%3A%22question%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.