PHPackages                             infinite4evr/php-tamtam-bot-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. infinite4evr/php-tamtam-bot-api

ActiveLibrary[API Development](/categories/api)

infinite4evr/php-tamtam-bot-api
===============================

Api Library for TamTam Bot Api

6291PHP

Since Nov 11Pushed 6y ago1 watchersCompare

[ Source](https://github.com/infinite4evr/php-tamtam-bot-api)[ Packagist](https://packagist.org/packages/infinite4evr/php-tamtam-bot-api)[ RSS](/packages/infinite4evr-php-tamtam-bot-api/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

PHP-TamTam-Bot-Api
==================

[](#php-tamtam-bot-api)

[![CodeFactor](https://camo.githubusercontent.com/fd2077a9be387b811727abc293444bc6bb7234adb9219650c010bbaed6401fe5/68747470733a2f2f7777772e636f6465666163746f722e696f2f7265706f7369746f72792f6769746875622f696e66696e697465346576722f7068702d74616d74616d2d626f742d6170692f6261646765)](https://www.codefactor.io/repository/github/infinite4evr/php-tamtam-bot-api)[![PHP](https://camo.githubusercontent.com/7001dc230291c2a963ca66407574a82f5dfef7c1a7ab0b0356a4f4818a2ca106/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344352e332d3838393262662e737667)](https://camo.githubusercontent.com/7001dc230291c2a963ca66407574a82f5dfef7c1a7ab0b0356a4f4818a2ca106/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344352e332d3838393262662e737667)[![CURL](https://camo.githubusercontent.com/f5a3b595480ac21ec43e745984c47d97fcc96f430547805750cd31928d67b28f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6355524c2d72657175697265642d677265656e2e737667)](https://camo.githubusercontent.com/f5a3b595480ac21ec43e745984c47d97fcc96f430547805750cd31928d67b28f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6355524c2d72657175697265642d677265656e2e737667)

A very simple PHP [TamTam Bot API](https://dev.tamtam.chat).
Compliant with the Sep,2019 tamtam Bot API update.

A working example bot is available to test at [@ExampleBot](https://tt.me/ExampleBot)Code available at /exampleBot/exampleBot.php

Requirements
------------

[](#requirements)

- PHP &gt;= 5.3
- Curl extension for PHP5 must be enabled.
- tamtam API key, you can get one simply with [@primeBot](https://dev.tamtam.chat/#section/About/@PrimeBot) with simple commands right after creating your bot.

For the WebHook:

- TamTam does not require ssl as per my knowledge, so just put up your library on a server and use the setWebhook() command

Download
--------

[](#download)

#### Using Composer

[](#using-composer)

```
composer require infinite4evr/php-tamtam-bot-api

```

#### Using Git

[](#using-git)

From a project directory, run:

```
git clone https://github.com/infinite4evr/php-tamtam-bot-api.git

```

Installation
------------

[](#installation)

#### Via tamtamBotPHP class

[](#via-tamtambotphp-class)

Copy tamtam.php into your server and include it in your new bot script:

```
require_once('tamtam.php');

$tamtam = new tamtam('YOUR bot TOKEN HERE');
```

Note: To enable error log file, also copy TamTamErrorLogger.php in the same directory of TamTam.php file.

Configuration (WebHook)
-----------------------

[](#configuration-webhook)

Use the tamtam class setWebhook('url) method

Examples
--------

[](#examples)

```
$tamtam = new tamtam('YOUR tamtam TOKEN HERE');
$tamtam->setWebhook('https://mywebhook.com/mywebhook.php');
//to delete webhook
$tamtam->deleteWebhook('https://mywebhook.com/mywebhook.php');
//to check subscriptions
$tamtam->getSubscriptions());
```

```
$tamtam = new tamtam('YOUR tamtam TOKEN HERE');

$chatId = $tamtam->getRecipientChatId();
$content = array('chat_id' => $chatId, 'text' => 'Test');
$tamtam->sendMessage($content);
```

If you want to get some specific parameter from the tamtam response:

```
$tamtam = new tamtam('YOUR tamtam TOKEN HERE');

$result = $tamtam->getData();
$text = $result['message']['body']['text'];
$userId = $result['message'] ['sender']['user_id'];
$content = array('user_id' => $userId, 'text' => 'Test');  // it can be any of user_id or chat_id
$tamtam->sendMessage($content);
```

To send a Photo :

```
// Load a local file to upload. If is already on tamtam's Servers just pass the resource id
$img = '/path/to/file' ;  // relative path, if you're passing abolsolute path then set $absolutePath parameter = true;
$content = array('chat_id' => $chat_id, 'photo' => $img );
$tamtam->sendPhoto($content);
```

See exampleBot.php or update exampleBot.php for the complete example. If you wanna see the exampleBot in action [add it](https://tt.me/ExampleBot).

If you want to use getUpdates instead of the WebHook you need to call the the getUpdates() function inside a loop for cycle.

```
$tamtam = new tamtam('YOUR tamtam TOKEN HERE');

$req = $tamtam->getUpdates();

for ($i = 0; $i < $tamtam-> UpdateCount(); $i++) {
	// You NEED to call serveUpdate before accessing the values of message in tamtam Class
    $data = $req[$i];
    $tamtam->setData($data);
	$text = $tamtam->getText();
	$chat_id = $tamtam->getChatID();

	if ($text == '/start') {
		$reply = 'Working';
		$content = array('chat_id' => $chat_id, 'text' => $reply);
		$tamtam->sendMessage($content);
	}
	// DO OTHER STUFF
}
```

Functions
---------

[](#functions)

For a complete and up-to-date functions documentation check

Build keyboards
---------------

[](#build-keyboards)

tamtam's bots can have only one kind of keyboard : inline\_keyboard The InlineKeyboard is linked to a particular message

[![ReplyKeabordExample](https://camo.githubusercontent.com/4830c973663a2ba0ac1e840a7e99bd46bbcf5b15b537323809173d1600c2402e/68747470733a2f2f696d6775722e636f6d2f3663774d355658)](https://camo.githubusercontent.com/4830c973663a2ba0ac1e840a7e99bd46bbcf5b15b537323809173d1600c2402e/68747470733a2f2f696d6775722e636f6d2f3663774d355658)using this code:

```
    // 4 kinds of buttons possible, please refer to documentation
    $callbackButton = $bot->buildCallbackButton('I am Callback Button', 'callback_data', 'positive');
    $linkButton =  $bot->buildLinkButton('I am link', 'https://infinite4evr.com');
    $contactButton = $bot->buildRequestContactButton('I am requesting Contact');
    $geoLocation = $bot->buildRequestGeoLocationButton('I am geo Request');
    $keyboard = [
                  [$callbackButton],         // each row, array of buttons
                  [$linkButton],
                  [$contactButton,$geoLocation]  // two buttons in same row
    ];
    $inlineKeyboard = $bot->buildInlineKeyboard($keyboard);  // making the final keyboard
    $content = ['user_id' => $user_id,'text' => 'All Inline Buttons', 'attachments' => [$inlineKeyboard]];
    $bot->sendMessage($content);
```

More example coming soon, check /exampleBot/exampleBot.php for an example

License
-------

[](#license)

This open-source software is distributed under the MIT License. See LICENSE.md

Contributing
------------

[](#contributing)

All kinds of contributions are welcome - code, tests, documentation, bug reports, new features, etc...

- Send feedbacks.
- Submit bug reports.
- Write/Edit the documents.
- Fix bugs or add new features.

Contact me
----------

[](#contact-me)

You can contact me [via tamtam](https://tt.me/infinite4evr/) but if you have an issue please [open](https://github.com/infinite4evr/php-tamtam-bot-api/issues) one.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/d72885dd67b9108b45eea37e54b493fb665173204e48600b6334b78fbd8d3a01?d=identicon)[infinite4evr](/maintainers/infinite4evr)

---

Top Contributors

[![infinite4evr](https://avatars.githubusercontent.com/u/24416598?v=4)](https://github.com/infinite4evr "infinite4evr (49 commits)")

---

Tags

apibotclasslibraryphptamtam

### Embed Badge

![Health badge](/badges/infinite4evr-php-tamtam-bot-api/health.svg)

```
[![Health](https://phpackages.com/badges/infinite4evr-php-tamtam-bot-api/health.svg)](https://phpackages.com/packages/infinite4evr-php-tamtam-bot-api)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
