The Challenge
Keeping up with cryptocurrency prices, historical highs/lows, and significant events like halving is timeāconsuming and errorāprone. I wanted to build an agent that could:
- Fetch live pricing for any coin
- Answer questions like āWhen was the allātime high for SHIB?ā or āWhen is the next BTC halving?ā
- Integrate seamlessly into Telex.im so users can chat in a familiar workspace
This is the story of how I built CryptoMate, using the Mastra agent framework and integrated it via Telexās A2A protocol.
š§Ŗ Tech Stack
Hereās what I used:
- Mastra: for defining the agent and workflows
- Telex.im: for chatāagent integration via JSONāRPC A2A
- Node.js + Express: backend server for the agent
- Axios: to fetch data from the CoinGecko API
- Railway.app: cloud hosting and deployment
āļø Architecture Overview
š§āš» User message (via Telex)
ā
š” JSON-RPC Request
ā
š§ Express Server (Node.js)
ā
āļø Logic Layer
āā CoinGecko API (for live crypto data)
āā Mastra Agent (for natural-language handling)
ā
š¬ JSON-RPC Response
ā
š± Message displayed on Telex
š§ Building CryptoMate with Mastra
StepāÆ1. Install Mastra
In the project folder, run:
npm install @mastra/core
This installed the core Mastra package which includes agent, tools, workflows and more. ([npmjs.com][1])
Step 2: Agent setup
import { Agent } from "@mastra/core/agent";
import dotenv from "dotenv";
dotenv.config();
export const cryptoTrackerBot = new Agent({
name: "crypto-tracker-bot",
instructions: `
You are a helpful cryptocurrency assistant.
You can answer general crypto-related questions,
provide insights about Bitcoin, Ethereum, and other coins,
and guide users about the crypto market.
If the user asks for a price, the data will be fetched from an API,
so just confirm it politely.
Keep your responses short, clear, and friendly.
`,
model: "gpt-4o-mini",
openaiApiKey: process.env.OPENAI_API_KEY
});
Step 3: I Used the agent in theserver/backend
In server.js, when you receive a message from Telex, call:
const aiResponse = await cryptoTrackerBot.run(text);
This sends the userās input to Mastra, gets a response, and you can then send that reply back to Telex in the correct JSON-RPC format.
Step 4: I created the Mastra workflow.json file
This file communicates with Telex the location and function of the Ai agent
{
"active": true,
"category": "utilities",
"description": "A crypto tracker bot that provides real-time prices for cryptocurrencies.",
"id": "cryptoTrackerBot123",
"long_description": "You are a helpful crypto tracker bot that fetches live cryptocurrency prices and market information using the CoinGecko API. Users can ask for the price of any coin by name or symbol.",
"name": "crypto-tracker-bot",
"nodes": [
{
"id": "crypto_tracker_bot_node",
"name": "crypto-tracker-bot",
"parameters": {},
"position": [500, 100],
"type": "a2a/mastra-a2a-node",
"typeVersion": 1,
"url": "cryptomate-production.up.railway.app"
}
],
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"short_description": "Tracks live crypto prices using CoinGecko"
}
š Deploying & Telex Integration
- Deployed to Railway.app and updated the
workflow.jsonwith the live URL - Added the agent on Telex.im and published it š Link to my agent: [https://telex.im/telex-ai-intergration/colleagues/019a4767-aadf-7e17-99e9-954eaa1d3545/019a4767-1277-7d2d-8e9e-714192aff16e] (What the agent does: provides live crypto pricing and insights, handles coin history and concept questions.)
And of course: https://telex.im/ ā an AI agent platform like Make, a Slack alternative for bootcamps and communities.
š§ What Worked & What Didnāt
ā Worked
- Mastra made creating the agent straightforward
- Telex A2A protocol integration was smooth once the JSON format was correct
- CoinGecko provided reliable price data
ā Challenges
- Initial Mastra install issue: had to install via GitHub because
npm install mastrafailed - Workflow trigger sometimes showed āWill the workflow run: Falseā ā resolved by reāuploading the updated
workflow.jsonand ensuring the URL matched deployment - Handling nonāprice questions gracefully required adding the timeout logic so Mastra fallback didnāt hang
š Tips for Your Own Agent
- Start simple: price queries first, fallback logic later
- Test locally with Postman or curl before Telex
- Use environment variables ā never hardcode API keys
- Monitor logs: what Telex sends vs what your endpoint receives
- Reāupload your workflow every time you change the URL
š” The project is open to the community!
Feel free to:
- Check out the source code
- Open issues or share feedback
- Contribute enhancements
- Fork it and build your own version
š https://github.com/GodlyPatrick/CryptoMate.git
š Conclusion
Building CryptoMate showed me just how powerful the combination of Mastra + Telex can be for agents. Whether youāre tracking prices, building a devāassistant, or automating community workflows, this stack gives you a fast path from idea ā live chatbot.
Go ahead and build something cool!
Top comments (0)