AlekSystem Workflow Detail

Send subscription renewal reminders via Telegram with Supabase Workflow Solution

Send subscription renewal reminders via Telegram with Supabase

Subscription Renewal Reminder – Telegram & Supabase This workflow tracks upcoming subscription expiry dates stored in Supabase and automatically sends person...

Rank 61 Verified workflow

Workflow overview

Why this workflow matters

Relevant for managed services and support workflows. Supports knowledge capture and document intelligence use cases.

Subscription Renewal Reminder – Telegram & Supabase This workflow tracks upcoming subscription expiry dates stored in Supabase and automatically sends personalized renewal-reminder messages to each customer via Telegram. It is designed to be triggered by an HTTP Webhook (manually or on a schedule) and ensures that customers are notified a configurable number of days before their subscription lapses. > Community Template Disclaimer > This is a community-contributed AlekSystem workflow template. It is provided “as-is” without official support from AlekSystem GmbH. Always test thoroughly before using in production. Pre-conditions/Requirements Prerequisites AlekSystem instance (self-hosted or AlekSystem.cloud) Supabase project with a subscriptions table (id, customer_name, expiration_date, telegram_chat_id, notified) A Telegram Bot created via @BotFather Outbound HTTPS access from AlekSystem to api.telegram.org and your Supabase project REST endpoint Required Credentials Supabase Service Role Key** – Full access for reading/writing the subscriptions table Telegram Bot Token** – To send messages from your bot AlekSystem Webhook URL** – Auto-generated when you activate the workflow (ScrapeGraphAI API Key is *not* required for this non-scraping workflow.) Specific Setup Requirements | Environment Variable | Example Value | Purpose | |----------------------|--------------|---------| | SUPABASE_URL | https://xyzcompany.supabase.co | Base URL for Supabase REST API | | SUPABASE_KEY | eyJhbGciOiJI... | Service Role Key | | TELEGRAM_TOKEN | 609012345:AA... | Bot token obtained from BotFather | | REMINDER_DAYS | 3 | Days before expiry to notify | How it works This workflow tracks upcoming subscription expiry dates stored in Supabase and automatically sends personalized renewal-reminder messages to each customer via Telegram. It is triggered by an HTTP Webhook (manually or via external scheduler) and ensures that customers are notified a configurable number of days before their subscription lapses. Key Steps: Receive Trigger (Webhook)**: External call fires the workflow or an internal Cron node can be added. Set Static Parameters**: The Set node calculates “today + REMINDER_DAYS”. Query Supabase**: Fetch all subscriptions expiring on or before the calculated date and not yet notified. Branch Logic (If node)**: Check if any subscriptions were returned. Loop & Dispatch (Code + Telegram nodes)**: Iterate over each customer row, compose a message, and send via Telegram. Flag as Notified (Supabase Update)**: Update each processed row to prevent duplicate reminders. Respond to Webhook**: Return a concise JSON summary for logging or downstream integrations. Set up steps Setup Time: 15–20 minutes Create Telegram Bot a. Open Telegram and talk to @BotFather → /newbot b. Copy the given bot token; paste it into AlekSystem Telegram credentials. Prepare Supabase a. Create a table named subscriptions with columns: id (uuid), customer_name (text), expiration_date (date), telegram_chat_id (text), notified (bool, default false) b. Obtain the Service Role Key from Project Settings → API. Import the Workflow a. In AlekSystem, click Templates → Import and select “Subscription Renewal Reminder – Telegram & Supabase”. b. Replace placeholder credentials in the Supabase and Telegram nodes. Define Environment Variables (Optional but recommended) Add SUPABASE_URL, SUPABASE_KEY, TELEGRAM_TOKEN, and REMINDER_DAYS in Settings → Environment Variables for easy maintenance. Activate the Workflow Copy the production webhook URL and (optionally) set up a cron job or AlekSystem Cron node to hit it daily. Node Descriptions Core Workflow Nodes: Webhook** – Entry point; triggers the workflow via HTTP request. Set (Calculate Target Date)** – Defines targetDate = today + REMINDER_DAYS. Supabase (Select)** – Retrieves expiring subscriptions that haven’t been notified. If (Rows > 0?)** – Determines whether to continue or exit early. Code (For-Each Loop)** – Iterates through each returned row to send messages and update status. Telegram** – Sends a personalized renewal reminder to the customer’s chat. Supabase (Update)** – Flags the subscription row as notified = true. Respond to Webhook** – Returns a JSON summary with counts of sent messages. Sticky Notes** – Inline documentation for maintainers (non-executable). Data Flow: Webhook → Set → Supabase (Select) → If → Code → Telegram → Supabase (Update) → Respond to Webhook Customization Examples Send Slack Notifications Instead of Telegram // Replace Telegram node with Slack node const message = Hi ${item.customer_name}, your subscription expires on ${item.expiration_date}.; return [{ text: message, channel: item.slack_channel_id }]; Notify 7 Days & 1 Day Before Expiry // In Set node items[0].json.reminderOffsets = [7, 1]; // days return items; Data Output Format The workflow outputs structured JSON data: { "totalSubscriptionsChecked": 42, "remindersSent": 13, "timestamp": "2024-05-27T09:15:22.000Z" } Troubleshooting Common Issues No messages sent – Check the If node; ensure REMINDER_DAYS is set correctly and the Supabase query returns rows. Telegram error 403 – The user hasn’t started a chat with your bot. Ask the customer to click “Start” in Telegram. Performance Tips Batch database updates instead of row-by-row when dealing with thousands of records. Cache Supabase responses if you expect multiple workflows to query the same data within seconds. Pro Tips: Use the Cron node inside AlekSystem instead of external schedulers for a fully self-contained setup. Add an Email node after the Telegram node for multi-channel reminders. Store template messages in Supabase so non-developers can update wording without editing the workflow.

Best fit

Categories

AI/MLCommunicationDocument Ops

Services

TelegramSupabase

Use cases

support automationdocument intelligenceemail workflow automation