Telegram Bot SDK
Receive decision requests in your Telegram bot
Installation
npm install @noxy-network/telegram-bot-sdk@2.0.1
# or
yarn add @noxy-network/telegram-bot-sdk@2.0.1
# or
pnpm add @noxy-network/telegram-bot-sdk@2.0.1
Quick Start
import { NoxyTelegramClient, NoxyDecisionOutcomeValues } from '@noxy-network/telegram-bot-sdk';
// Create the client
const client = await NoxyTelegramClient.create({
identity: {
address: '0x…',
signer: async (data) => wallet.signMessage({ message: { raw: data } }),
},
network: {
appId: 'your-app-id',
relayUrl: 'https://relay.noxy.network',
},
storage: { dataDir: './.noxy-data' },
});
// Initialize the client
await client.initialize();
// Subscribe to decision requests
await client.on(async (decisionId, decision) => {
// Update Telegram UI, wait for user tap, then:
const isApproved = await showConfirmDialog(decision);
// Send decision outcome to Noxy, which will be orchestrated to your agent
await client.sendDecisionOutcome(
decisionId,
isApproved ? NoxyDecisionOutcomeValues.APPROVE : NoxyDecisionOutcomeValues.REJECT,
);
});
// when finished, disconnect from Noxy
await client.close();