Files
twenty/packages/twenty-apps/hacktoberfest-2025/activity-summary
Ali Ilman be7c2ad40a [ENHANCEMENT] [ACTIVITY-SUMMARY] Improvisations post-hacktoberfest (#15882)
## Background
Team Comfortably Summed had submitted Activity Summary for Twenty's
Hacktoberfest. This is a follow-up PR post-Hacktoberfest.

## Changes
### Purpose
>_What is the objective?_

To improve the code based on human and bot comments from the initial
Hacktoberfest PR, and to improve the robustness of task completion
calculation.
>_Are we solving a problem or making necessary changes to support an
existing and / or a new feature?_

Making changes to improve existing features.
### Summary
> _Are there files we can ignore?_

None.
> _Please provide a high-level summary of the changes._

- Corrects `README.md` by removing irrelevant commands and unnecessary
configuration notes
- Updates `people-creation-summariser.ts`
- Replaces requesting of company for each person by including `depth=1`
as query parameter in GET /people request as suggested by Martin Muller
– link to comment:
[link](https://github.com/twentyhq/twenty/pull/15510#discussion_r2486019035)
- Updates `senders.ts`
  - Renames `formattedMesage` to `formattedMessage`
- Updates `task-creation-summariser.ts`
- Improves calculation of completed task percentage by relying only on
list of completed tasks and total list of tasks
- The initial implementation includes relying on pending tasks and
pending overdue tasks which can result in undesired calculation outcome
2025-11-18 17:23:11 +01:00
..
2025-11-12 10:42:55 +01:00

Twenty CRM Activity Reporter

A TypeScript-based reporting bot that summarizes activity from your Twenty CRM workspace and sends daily/periodic reports to Slack, Discord, and WhatsApp. Meet Kylian Mbaguette, your friendly CRM activity reporter!

Features

  • 🧑‍💻 People & Company Tracking: Summarizes newly created people and companies
  • 🎯 Opportunity Monitoring: Reports on new opportunities created, broken down by stage
  • Task Analytics:
    • Tracks task creation
    • Calculates on-time completion rates
    • Identifies team members with the most overdue tasks (the "slackers")
  • 🔔 Multi-Platform Notifications: Send reports to Slack, Discord, and/or WhatsApp
  • Configurable Time Range: Look back any number of days

Prerequisites

  • Node.js (v14 or higher recommended)
  • TypeScript
  • A Twenty CRM account with API access
  • Optional: Slack webhook, Discord webhook, and/or WhatsApp Business API access

Installing dependencies

# Install dependencies
yarn install

Environment Variables

Variable Required Description
TWENTY_API_KEY Yes Your Twenty CRM API key
DAYS_AGO Yes Number of days to look back for the report
SLACK_HOOK_URL No Slack incoming webhook URL
DISCORD_WEBHOOK_URL No Discord webhook URL
FB_GRAPH_TOKEN No Facebook Graph API token for WhatsApp
WHATSAPP_RECIPIENT_PHONE_NUMBER No WhatsApp recipient phone number (with country code)

Project Structure

.
├── index.ts                              # Main entry point
├── people-creation-summariser.ts         # Summarizes people/company creation
├── opportunity-creation-summariser.ts    # Summarizes opportunity creation
├── task-creation-summariser.ts           # Summarizes task creation & completion
├── senders.ts                            # Handles sending to Slack/Discord/WhatsApp
├── utils.ts                              # API request utility
└── README.md

How It Works

  1. Data Collection: The bot queries the Twenty CRM API for activities within the specified time range
  2. Analysis:
    • Counts new people and companies
    • Categorizes opportunities by stage
    • Calculates task completion rates and identifies overdue tasks
  3. Reporting: Formats the data into friendly messages
  4. Distribution: Sends reports to configured platforms (Slack, Discord, WhatsApp)

Report Format

Each report includes:

Bonjour! 🥖 Je m'appelle Kylian Mbaguette. Over the last X days:

🧑‍💻 People & Companies
- X People and Y Companies were added

🎯 Opportunities
- X Opportunities were added: Y in NEW, Z in PROPOSAL

📋 Tasks
- X Tasks were created
- Y% Tasks were completed on time
- [Name] slacked the most with Z Tasks overdue

API Integration

This bot uses the Twenty CRM REST API. The following endpoints are used:

  • GET /people - Fetch people data
  • GET /opportunities - Fetch opportunity data
  • GET /tasks - Fetch task data
  • GET /workspaceMembers/{id} - Fetch workspace member details

Notes

  • The "slacker" detection is lighthearted and identifies team members with the most overdue tasks
  • At least one messaging platform must be configured for the bot to send reports
  • The bot uses ISO date format (YYYY-MM-DD) for date filtering
  • Task completion percentage only considers incomplete tasks (excludes already completed tasks from the calculation)

Troubleshooting

Issue: No messages being sent

  • Solution: Ensure at least one messaging platform is configured with valid credentials

Issue: API authentication errors

  • Solution: Verify your TWENTY_API_KEY is correct and has necessary permissions

Issue: WhatsApp messages not sending

  • Solution: Ensure both FB_GRAPH_TOKEN and WHATSAPP_RECIPIENT_PHONE_NUMBER are set correctly

Contributing

Built with ❤️ and 🥖 by Azmat, Ali and Mike from 9dots