Global AI Network
Agent Template v1.0

Razorpay Analytics Telegram Bot

Automate Razorpay analytics with AI-powered intent classification—instantly retrieve payments, orders, and refunds via Telegram with intelligent natural language processing.

10+
Deployments
20m
Setup Time
Free
Pricing

Need custom configuration?

Our solution engineers can help you adapt this agent to your specific infrastructure and requirements.

Enterprise Grade Best Practices Production Optimized

INTEGRATED_MODULES

Google Gemini
Google Gemini
Razorpay
Razorpay
Telegram
Telegram
Step by Step

Setup Tutorial

mission-briefing.md

PayInsighter: Razorpay Analytics Bot Setup Guide

What This Agent Does

PayInsighter is an intelligent Razorpay analytics assistant that connects to your Telegram account and answers questions about your payment operations in real-time. Simply message the bot with queries about payments, orders, or refunds, and it instantly retrieves and analyzes your Razorpay data using AI-powered natural language processing.

Key benefits:

  • Instant insights without logging into Razorpay dashboard
  • Natural language queries – ask questions conversationally
  • Real-time data – always current payment, order, and refund information
  • Time savings – reduce manual data lookups by 90%
  • Smart categorization – automatically routes queries to the right data source

Target use cases:

  • Quick payment status checks during business hours
  • Order fulfillment verification
  • Refund processing inquiries
  • Daily financial health monitoring
  • Team collaboration on payment analytics

Who Is It For

This workflow is ideal for:

  • E-commerce businesses managing high transaction volumes
  • SaaS companies tracking subscription payments
  • Marketplace operators monitoring multi-vendor transactions
  • Finance teams needing quick access to payment metrics
  • Customer support teams answering payment-related questions
  • Business owners wanting real-time payment visibility

Required Integrations

Telegram

Why it's needed: Telegram serves as your communication interface. The bot listens for incoming messages and sends formatted responses directly to your chat.

Setup steps:

  1. Open Telegram and search for @BotFather
  2. Send the command /newbot
  3. Follow the prompts to name your bot (e.g., "PayInsighter")
  4. Copy the API token provided (format: 123456789:ABCdefGHIjklmnoPQRstuvWXYZ)
  5. In TaskAGI, navigate to IntegrationsTelegram
  6. Paste your API token in the Bot Token field
  7. Click Authenticate to verify the connection
  8. Note your Chat ID (you'll need this for testing)

How to obtain credentials:

  • The API token is automatically generated by BotFather
  • Your Chat ID can be found by messaging your bot and checking the webhook payload in TaskAGI logs

Configuration in TaskAGI:

  • Store the bot token securely in your integration settings
  • Enable Webhook mode for real-time message processing
  • Set webhook URL to your TaskAGI instance endpoint

Google Gemini

Why it's needed: Gemini powers the AI intelligence behind PayInsighter. It classifies user intents, parses complex queries, and formats responses in natural, conversational language.

Setup steps:

  1. Visit Google AI Studio
  2. Click Get API Key in the left sidebar
  3. Select Create API Key in new project (or existing project)
  4. Copy the generated API key
  5. In TaskAGI, go to IntegrationsGoogle Gemini
  6. Paste your API key in the API Key field
  7. Select Model: gemini-2.5-flash (recommended for speed and cost-efficiency)
  8. Click Test Connection to verify

How to obtain credentials:

  • Google Gemini API keys are free to generate with a Google account
  • No credit card required for initial free tier usage
  • Check your usage limits at Google AI Console

Configuration in TaskAGI:

  • Model selection: gemini-2.5-flash (optimized for this workflow)
  • Temperature: 0.7 (balanced creativity and consistency)
  • Max tokens: 1000 (sufficient for detailed responses)

Razorpay

Why it's needed: Razorpay is your payment data source. The workflow fetches real-time information about payments, orders, and refunds directly from your Razorpay account.

Setup steps:

  1. Log in to your Razorpay Dashboard
  2. Navigate to SettingsAPI Keys
  3. Under Key ID, copy your Key ID (public key)
  4. Under Key Secret, copy your Key Secret (private key) – keep this confidential
  5. In TaskAGI, go to IntegrationsRazorpay
  6. Paste both Key ID and Key Secret in their respective fields
  7. Click Authenticate to verify access
  8. Confirm your Account ID is auto-populated

How to obtain credentials:

  • Keys are available in your Razorpay dashboard under Settings
  • Generate new keys if needed (old keys can be revoked)
  • Never share your Key Secret publicly

Configuration in TaskAGI:

  • Use Live Keys for production (not test keys)
  • Store credentials in environment variables for security
  • Enable Read-only access if available for additional security

Configuration Steps

Step 1: Telegram Webhook Setup

The Telegram Trigger node initiates the workflow when a user sends a message.

Configuration:

  • Trigger Type: Webhook
  • Event: message
  • Extract: Message text and Chat ID
  • Expected input: User query about payments, orders, or refunds

Example incoming message:

"How many payments did I receive today?"

Step 2: Intent Classification

The Intent Classifier node analyzes the user message and determines which category it belongs to.

Configuration:

  • Model: gemini-2.5-flash
  • Prompt: Classify user message into: Payment, Order, Refund, or General
  • Output: Intent classification with confidence score

Data flow: Telegram TriggerIntent Classifier

The classifier returns one of four intents:

  • payment – queries about transactions
  • order – queries about orders
  • refund – queries about refunds
  • general – other questions or greetings

Step 3: Conditional Routing

Four If Condition nodes route the message to the appropriate handler based on intent.

Configuration for each branch:

  • Payment Branch: Condition: intent == "payment"
  • Order Branch: Condition: intent == "order"
  • Refund Branch: Condition: intent == "refund"
  • General Chat Branch: Condition: intent == "general"

Data flow: Intent Classifier → Four parallel branches


Step 4: Query Parsing (Payment Example)

The Payments Query Parser extracts structured parameters from the user's natural language query.

Configuration:

  • Model: gemini-2.5-flash
  • Prompt: Extract filters like date range, amount range, status, customer ID
  • Output: Structured JSON with parameters

Example:

{
  "date_from": "2024-01-01",
  "date_to": "2024-01-31",
  "status": "captured",
  "limit": 50
}

Data flow: Payment BranchPayments Query ParserParse Payment Params


Step 5: API Data Fetching

The Fetch All Payments node retrieves data from Razorpay using parsed parameters.

Configuration:

  • Integration: Razorpay
  • Method: fetchAllPayments
  • Parameters: Use output from Parse Payment Params
  • Timeout: 30 seconds

Data flow: Parse Payment ParamsFetch All Payments


Step 6: Response Formatting

The Payment Response Formatter transforms raw API data into a conversational, user-friendly response.

Configuration:

  • Model: gemini-2.5-flash
  • System prompt: "You are PayInsighter, a Razorpay analytics bot. Format data clearly with key metrics highlighted."
  • Input: Raw payment data from Razorpay API
  • Output: Natural language response

Example output:

You received 47 payments totaling ₹1,24,500 in January 2024. 
45 were successful, 2 are pending. Average transaction: ₹2,648.

Data flow: Fetch All PaymentsPayment Response Formatter


Step 7: Response Merging

The Merge Responses node combines outputs from all four branches (payment, order, refund, general).

Configuration:

  • Type: Merge/Combine
  • Input: All four formatter outputs
  • Output: Single response object

Data flow: All formatters → Merge Responses


Step 8: Response Selection

The Select Response node picks the appropriate response based on which branch was executed.

Configuration:

  • Type: Function/Conditional selector
  • Logic: Return non-null response from executed branch
  • Output: Final formatted response

Data flow: Merge ResponsesSelect Response


Step 9: Telegram Delivery

The Send Telegram Response node delivers the final answer back to the user.

Configuration:

  • Integration: Telegram
  • Method: sendMessage
  • Chat ID: From original trigger
  • Message: From Select Response
  • Format: Plain text or markdown

Data flow: Select ResponseSend Telegram Response


Testing Your Agent

Pre-Launch Checklist

  • ✅ All three integrations authenticated
  • ✅ Razorpay API keys have read permissions
  • ✅ Telegram bot token is active
  • ✅ Google Gemini API quota available

Test Execution Steps

1. Send a Payment Query

  • Open Telegram and message your bot: "Show me my payments from last week"
  • Verify: Message appears in TaskAGI logs
  • Expected result: Bot responds with payment summary within 5 seconds

2. Test Order Query

  • Send: "How many orders are pending?"
  • Verify: Order branch executes (check node logs)
  • Expected result: Detailed order status breakdown

3. Test Refund Query

  • Send: "List refunds from January"
  • Verify: Refund data fetches successfully
  • Expected result: Refund summary with dates and amounts

4. Test General Chat

  • Send: "Hello!"
  • Verify: General chat handler activates
  • Expected result: Friendly greeting with bot capabilities

Success Indicators

  • ✅ Response time under 10 seconds
  • ✅ Accurate data matching Razorpay dashboard
  • ✅ Natural language formatting
  • ✅ No error messages in logs
  • ✅ All integrations show "Connected" status

Troubleshooting

  • No response: Check Telegram webhook URL in logs
  • Wrong data: Verify Razorpay API keys have correct permissions
  • Slow responses: Check Google Gemini quota usage
  • Intent misclassification: Rephrase query more specifically

Your PayInsighter bot is now ready to revolutionize how you access payment analytics! 🚀