Skip to content

SLA compatibility with admin only utility command and access#46

Merged
warengonzaga merged 8 commits intodevfrom
feat/admin-access
Jul 8, 2025
Merged

SLA compatibility with admin only utility command and access#46
warengonzaga merged 8 commits intodevfrom
feat/admin-access

Conversation

@warengonzaga
Copy link
Member

@warengonzaga warengonzaga commented Jul 7, 2025

This PR implements a comprehensive group setup and admin control system for the Unthread Telegram Bot, ensuring robust environment validation, admin-only commands, and role-based access control. The implementation includes strict enforcement of required environment variables, improved logging, batch operations for better performance, and enhanced user experience for both developers and end-users.

@warengonzaga warengonzaga added this to the 📦 v1.0.0-rc1 milestone Jul 7, 2025
@warengonzaga warengonzaga self-assigned this Jul 7, 2025
Copilot AI review requested due to automatic review settings July 7, 2025 16:13
@warengonzaga warengonzaga added api API integration and external services (Issues/PRs) database Database and data handling (Issues/PRs) sponsored Sponsored by GitHub Sponsors (Issues/PRs) maintainer Maintainer expertise required (Issues/PRs) labels Jul 7, 2025
@warengonzaga warengonzaga moved this to In Review in Unthread Partnership Jul 7, 2025
@warengonzaga
Copy link
Member Author

Resolving #46 #45 #36

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Enforces admin-only group configuration for support tickets by introducing a /setup command, a setup wizard, and environment validation for admin users.

  • Added permission utilities (validateAdminAccess, hasAdminAccess, requireAdminAccess) and bot-admin checks with retry prompts
  • Extended getOrCreateCustomer to block ticket creation in unconfigured groups and surface a clear error
  • Implemented GroupConfig and SetupState storage in BotsStore, new setup flow in commands, and updated docs for ADMIN_USERS

Reviewed Changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/utils/permissions.ts Admin-access validation and decorators
src/utils/botPermissions.ts Bot-admin status checks, prompts, and callback handling
src/services/unthread.ts getOrCreateCustomer now enforces setup and throws on unconfigured
src/sdk/types.ts New GroupConfig and SetupState interfaces
src/sdk/bots-brain/BotsStore.ts CRUD operations for group config and setup state
src/index.ts Registered setup command
src/events/message.ts Integrated setup text input before support flow
src/config/env.ts Added ADMIN_USERS parsing and placeholder validation
src/commands/index.ts Full /setup command implementation and wizard callbacks
README.md, .env.railway, .env.example Documentation updates for ADMIN_USERS and Redis URLs

@warengonzaga warengonzaga linked an issue Jul 7, 2025 that may be closed by this pull request
@warengonzaga warengonzaga merged commit db00696 into dev Jul 8, 2025
3 of 4 checks passed
@github-project-automation github-project-automation bot moved this from In Review to Done in Unthread Partnership Jul 8, 2025
@warengonzaga warengonzaga deleted the feat/admin-access branch July 8, 2025 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api API integration and external services (Issues/PRs) database Database and data handling (Issues/PRs) maintainer Maintainer expertise required (Issues/PRs) sponsored Sponsored by GitHub Sponsors (Issues/PRs)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants