Popular mobile messengers
Similar functionalities: chat, call, share images/videos
Viber
Tango
Skype
Telegram
LINE
kik
Large user base, but no open API
1 billion registered users
600 million registered users
300 million active users
Has open API
700m users
100m users
600m users
350m users
275m users
Similar apps
Include contents within apps, in apps purchase
Develop & share bots
Android
iOS
Web
Windows Mobile
Blackberry
Symbian
Supported Platforms
Telegram major advantages
WeChat major advantages
Two options for developers:
Bot API
What can we do with bots?
Bot Examples
Examples Bot Codes
<?php
define('BOT_TOKEN', '12345678:replace-me-with-real-token');
define('API_URL', 'https://api.telegram.org/bot'.BOT_TOKEN.'/');
function apiRequestWebhook($method, $parameters) {
if (!is_string($method)) {
error_log("Method name must be a string\n");
return false;
}
}
// more definitions
// ...
// more definitions
function processMessage($message) {
// process incoming message
$message_id = $message['message_id'];
$chat_id = $message['chat']['id'];
if (isset($message['text'])) {
// incoming text message
$text = $message['text'];
if (strpos($text, "/start") === 0) {
apiRequestJson("sendMessage", array('chat_id' => $chat_id, "text" => 'Hello', 'reply_markup' => array(
'keyboard' => array(array('Hello', 'Hi')),
'one_time_keyboard' => true,
'resize_keyboard' => true)));
} else if ($text === "Hello" || $text === "Hi") {
apiRequest("sendMessage", array('chat_id' => $chat_id, "text" => 'Nice to meet you'));
} else if (strpos($text, "/stop") === 0) {
// stop now
} else {
apiRequestWebhook("sendMessage", array('chat_id' => $chat_id, "reply_to_message_id" => $message_id, "text" => 'Cool'));
}
} else {
apiRequest("sendMessage", array('chat_id' => $chat_id, "text" => 'I understand only text messages'));
}
}
define('WEBHOOK_URL', 'https://my-site.example.com/secret-path-for-webhooks/');
if (php_sapi_name() == 'cli') {
// if run from console, set or delete webhook
apiRequest('setWebhook', array('url' => isset($argv[1]) && $argv[1] == 'delete' ? '' : WEBHOOK_URL));
exit;
}
$content = file_get_contents("php://input");
$update = json_decode($content, true);
if (!$update) {
// receive wrong update, must not happen
exit;
}
if (isset($update["message"])) {
processMessage($update["message"]);
}Available Bot Codes Example Languages
Telegram API
Examples
WeChat Extensions
Two options for developers:
WeChat API
WeChat API
Sharing via WeChat Message
Sharing via WeChat Message
WeChat API
4. Start coding
WeChat API
WXMediaMessage is used to share rich media from our apps to WeChat
WXMediaMessage msg = new WXMediaMessage();
msg.title = "Some Title";
msg.description = "Some Description";WXMediaMessage *message = [WXMediaMessage message];
message.title = @"Some Title";
message.description = @"Amazing Sunset";
[message setThumbImage:[UIImage imageNamed:@"res1thumb.png"]];Android example
iOS example
WXMediaMessage has an attribute mediaObject. It is used to assign rich media types. http://dev.wechat.com/wechatapi/messages-moments
WeChat Official Accounts
WeChat Official Accounts
Subscription Accounts
WeChat Official Accounts
Service Accounts
WeChat Official Accounts
Enterprise Accounts
WeChat Official Accounts
Basic Platform Features
Available to all type of OAs
WeChat Official Accounts
Basic Developer Tools
Available to all type of OAs
WeChat Official Accounts
Advanced Developer Tools
Requires verified service or enterprise account
WeChat Official Accounts
Advanced Developer Tools
Requires verified service or enterprise account
Pro
Fast & secure
Cons
Only a messaging app
Pro
Built-in payment & social functions
Cons
Bulky & privacy not guaranteed