chanify / sdk
Official Chanify SDK - monetize your Telegram bot with ads
0.1.0
2026-05-02 01:45 UTC
Requires
- php: >=8.0
- ext-curl: *
- ext-json: *
README
Official PHP SDK for Chanify — the ad network for Telegram bots, channels, and Mini Apps.
Installation
composer require chanify/sdk
Quick Start
use Chanify\Client; $chanify = new Client('chanify_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); // After each bot response — add one line: $chanify->showAd($chatId, [ 'userId' => $userId, 'languageCode' => $languageCode, 'isPremium' => $isPremium, ]);
Full API
$chanify->showAd(int $chatId, array $userMeta = []): bool
| Parameter | Type | Required | Description |
|---|---|---|---|
chatId |
int | Yes | Telegram chat ID |
userMeta['userId'] |
int | No | Telegram user ID |
userMeta['languageCode'] |
string | No | User language code, e.g. "en" |
userMeta['isPremium'] |
bool | No | Whether the user has Telegram Premium |
userMeta['country'] |
string | No | ISO 3166-1 alpha-2 country code |
Returns true if an ad was shown, false otherwise. Never throws exceptions — safe to call without try/catch.
Example with Telegram Bot API
<?php require 'vendor/autoload.php'; use Chanify\Client; $chanify = new Client('chanify_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); $update = json_decode(file_get_contents('php://input'), true); $message = $update['message'] ?? null; if ($message) { $chatId = $message['chat']['id']; $userId = $message['from']['id']; $lang = $message['from']['language_code'] ?? null; $premium = $message['from']['is_premium'] ?? false; // Send your bot's response first // ... // Then show an ad $chanify->showAd($chatId, [ 'userId' => $userId, 'languageCode' => $lang, 'isPremium' => $premium, ]); }
Requirements
- PHP 8.0+
- ext-curl
- ext-json
Get your API key
- Sign up at chanify.online
- Go to Publisher → My Bots → Add Bot
- Copy your
chanify_live_API key from Step 3
Links
License
MIT