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

Sending self-approval messages in the App channel and not in a private message #15

Open
ErezWeiss opened this issue Sep 15, 2024 · 1 comment

Comments

@ErezWeiss
Copy link
Contributor

ErezWeiss commented Sep 15, 2024

HI!
We use the Slack bot app's Messages page as a live audit page - to know who requests what and when.
As an admin, I can see all the requests and who approved them.
We expect to see a message when people in the approvers' group get their approval (=self approval).
Nowadays they get a private message from the app that says:

The access request through profile 'Microservices Production Ephemeral Access'.
Group: production-activities
Your access will expire in 1 Hour
Self Approved

We want it to be visible to the rest of the admins, means all the approvers will get a message about this self-approval.
Thanks!
Erez

@ErezWeiss
Copy link
Contributor Author

This is my suggestion for SelfServeApproval.mjs, line 258

            // Notify all approvers about the self-approval
            const approverGroup = await profileManager.lookUpGroupUsersByName(this.approverGroup)
            for (const approver of approverGroup.users) {
                const approverSlackInfo = await client.users.lookupByEmail({email: approver.email})
                let messageString = `<@${slackUserId}> has self-approved access through profile _'${this.profileName}'_.\nGroup: ${selectedGroup}\nDuration: ${selectedTime}\nReason For Request: ${reasonForRequest}\n\`Self-Approved\``
                
                msgOption = {
                    channel: approverSlackInfo.user.id,
                    text: messageString,
                    blocks: [
                        {
                            type: 'section',
                            text: {
                                type: 'mrkdwn',
                                text: messageString
                            }
                        }
                    ]
                }
                await client.chat.postMessage(msgOption)
            }

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