Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add slack endpoint back in #49

Closed
maxneuvians opened this issue Jan 21, 2024 · 1 comment
Closed

Add slack endpoint back in #49

maxneuvians opened this issue Jan 21, 2024 · 1 comment

Comments

@maxneuvians
Copy link
Contributor

The old app included the following code:

def slack():
    data = parse_qs(app.current_request.raw_body.decode())
    if "text" in data:
        return {
            "response_type": "ephemeral",
            "blocks": [
                {
                    "type": "section",
                    "text": {
                        "type": "mrkdwn",
                        "text": "Share your secret with the following link: \n>https://%s/en/view/%s \n Note: your link is valid for the next 60 minutes"
                        % (
                            app.current_request.headers["host"],
                            encrypt_and_save(
                                data["text"][0],
                                int(time.time()) + 60 * 1000,
                            ),
                        ),
                    },
                }
            ],
        }
    else:
        return {
            "response_type": "ephemeral",
            "text": "Sorry, an error occured generating your secret.",
        }

This should be refactored and rethought to meet the needs of a slack command.

@maxneuvians
Copy link
Contributor Author

This might actually be a better fit for the SRE bot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant