Chat Bots API
How do I get started with the Chat Bots API?
To get started, you'll need to install the official @sociogram-dev/platform-api SDK via npm or yarn. This SDK allows your bot to communicate with the Sociogram Messenger platform. You'll need a BotToken for authentication, which you can obtain from the Sociogram Developer Portal after creating your bot.
How does my bot receive and send messages?
Your bot receives messages through webhook callbacks. You set up a webhook URL on your server, and Sociogram will send POST requests to this endpoint whenever a user sends a message to your bot. To send messages back, use the sdk.sendMessage(chatId, message) method from the platform API SDK.
What types of interactions can my bot handle?
Chat Bots can handle various types of interactions including:
- Text Messages: Receive and respond to text-based conversations
- Commands: Process specific commands initiated by users (e.g., /start, /help)
- Interactive Buttons: Display button menus and handle user selections
- Rich Media: Send images, GIFs, and other media types in responses
- Automated Workflows: Set up automated responses and conversation flows
How do I authenticate users with my bot?
When a user starts a conversation with your bot, Sociogram automatically provides their wallet address and user ID in the webhook payload. Your bot can use this information to identify and authenticate users without requiring any additional login steps.
Can my bot process payments?
Yes, your bot can process crypto payments using the same invoice system as Mini Apps. Create an invoice with your backend, present it to the user through the chat interface, and handle payment confirmations via webhooks. All payments are processed in USD₮ or SOL.
How do payouts for bot developers work?
Revenue generated from your Chat Bot accumulates in your Developer Balance. From the Sociogram Developer Portal, you can transfer these earnings to your Main Balance. Once the funds are in your Main Balance, you can withdraw them to your external crypto wallet.