https://github.com/gomoob/php-facebook-messenger
A PHP Library to easily work with the Facebook Messenger REST Web Services.
https://github.com/gomoob/php-facebook-messenger
facebook facebook-messenger facebook-messenger-bot facebook-messenger-platform php
Last synced: over 1 year ago
JSON representation
A PHP Library to easily work with the Facebook Messenger REST Web Services.
- Host: GitHub
- URL: https://github.com/gomoob/php-facebook-messenger
- Owner: gomoob
- License: bsd-3-clause
- Created: 2017-06-15T06:01:10.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-02-27T14:20:03.000Z (over 8 years ago)
- Last Synced: 2025-03-23T11:51:18.126Z (over 1 year ago)
- Topics: facebook, facebook-messenger, facebook-messenger-bot, facebook-messenger-platform, php
- Language: PHP
- Size: 342 KB
- Stars: 6
- Watchers: 6
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# php-facebook-messenger
> A PHP Library to easily send Facebook Messenger message with the REST Web Services.
[](https://packagist.org/packages/gomoob/php-facebook-messenger)
[](https://packagist.org/packages/gomoob/php-facebook-messenger)
[](https://travis-ci.org/gomoob/php-facebook-messenger)
[](https://coveralls.io/r/gomoob/php-facebook-messenger?branch=master)
[](https://codeclimate.com/github/gomoob/php-facebook-messenger)
[](https://packagist.org/packages/gomoob/php-facebook-messenger)
## First sample, creating a Facebook Messenger text message
```php
// Create a Facebook Messenger client
$client = Client::create()->setPageAccessToken('XXXX-XXX');
// Create a request to send a simple Text Message
$request = TextMessageRequest::create()
->setRecipient(Recipient::create()->setId('USER_ID'))
->setMessage(TextMessage::create()->setText('hello, world !'));
// Call the REST Web Service
$response = $client->sendMessage($textMessageRequest);
// Check if its ok
if($response->isOk()) {
print 'Great, the message has been sent !';
} else {
print 'Oups, the sent failed :-(';
print 'Status code : ' . $response->getStatusCode();
print 'Status message : ' . $response->getStatusMessage();
}
```
Easy, isn't it ?
## Documentation
In progress.
## About Gomoob
At [Gomoob](https://www.gomoob.com) we build high quality software with awesome Open Source frameworks everyday. Would
you like to start your next project with us? That's great! Give us a call or send us an email and we will get back to
you as soon as possible !
You can contact us by email at [contact@gomoob.com](mailto:contact@gomoob.com) or by phone number
[(+33) 6 85 12 81 26](tel:+33685128126) or [(+33) 6 28 35 04 49](tel:+33685128126).
Visit also http://gomoob.github.io to discover more Open Source softwares we develop.