Download the PHP package roysegall/facebook-messenger-send-api without Composer

On this page you can find all versions of the php package roysegall/facebook-messenger-send-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package facebook-messenger-send-api

Facebook Messenger send API

You started to write your but there is a problem - how to send back messages? You heads to the Messenger platform send API and start to read the documentation.

As you progress with the reading, you'll understand that if you want to send a text or an image required from to create and array with some confusing structure. But, that is not your worst problem - if you want to send generic template you need to send an enormous and confusing array.

This is where this library come in hand. The Facebook Messenger send API contains an object for each type of section in the send api for the Messenger platform. Combine that with the autocomplete feature that exists in any modern IDE and you'll get an easy way to construct the array.

Sending will be easy as well since there is a dedicated API for that. Let's dive in!

What are the principles and how they can assist you

If you'll have a look in the send api documentation you can see a specific structure:

And inside, there are more fields and object. Let's have a look on how to start the object:

After that, we need to start and build our payload object for a text(and sending it as well):

What we can see here? Since the text in under the content type section, and the text section have only text the code is very easy to understand: $facebook->contentType->text->text('This is a message.')

What about an image? Very easy:

$facebook->contentType->audio->url(URL);

Templates and button

Button have their own section, and templates have their own section. How this will work:

Sending an action

Action are a bit different that that. Since it's not a crazy payload we have a very simple task for that:

This will give the affect off typing bubbles and after 3 seconds they will disappear. Try it, it's cool :)

Adding tag

You can add a tag to your message:

Test it your self

After you'll get an access token and you find out the recipient user ID you can try your code by writing in the testing.php and run it.

If you don't know what is the user recipient ID(of your self in this case) you can get that by setting up the bot and start a conversation. Your recipient ID will be in the payload of the request.

Don't forget to populate variables!

Contribution

Documentation and unit testing will be more than welcome.


All versions of facebook-messenger-send-api with dependencies

PHP Build Version
Package Version
Requires guzzlehttp/guzzle Version ^6.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package roysegall/facebook-messenger-send-api contains the following files

Loading the files please wait ...