Giter VIP home page Giter VIP logo

fb-messenger-php's Introduction

Build Status Coverage badge

FB Messenger Bot PHP API

This is a PHP implementation for Facebook Messenger Bot API.

REQUIREMENTS

The minimum requirement is that your Web server supports PHP 5.4.

INSTALLATION

Version 1.2.2 is the last with PHP ">=5.4.0" support.
As of version 2.0, PHP 7.1.3 is required.

composer require "pimax/fb-messenger-php" "dev-master"
composer require "pimax/fb-messenger-php" "<version>"

BASIC USAGE

See this repo - https://github.com/pimax/fb-messenger-php-example

fb-messenger-php's People

Contributors

a-fawzy avatar arsengoian avatar chrisplusplus avatar fducom avatar gabriel-tandil avatar georgecheteles avatar jason-engage avatar kamal-sanjeewa avatar maxpinyugin avatar o2-web avatar oleksii909 avatar pulkit8 avatar stefanledin avatar terehru avatar univers3 avatar wittfabian avatar yiidiir avatar zahassanyum avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fb-messenger-php's Issues

Composer

Hi!

How can this be solved?
Root package 'pimax/fb-messenger-php' cannot require itself in its composer.json
Did you accidentally name your root package after an external package?

Cheers!

update version

could yo update library version (add new tag)? it need to update it in composer with stable flag

audio, video, file

Could you please add functionality to send audio, video and file type to fb?

What am i missing?

Hi,

With another simple code i found on web, my tokens are working.

I copied your files to the c9.io as php project and entered $verify_token and $token values both in index.php and config.php but nothing happens on FB page.
What am I missing? Anything else i should do except copying your files and replacing tokens? Sorry for question :(

index.php
config.php
compose.json
pimax directory ( FbBotApp.php,UserProfile.php, Messages directory(....) )

add version

i have two-level dependency of it library, and i need to have stable version of it. Could you add any tag for this repo?

php://input always empty

Not sure that it's your package problem but i have nothing in $data variable (json_decode(file_get_contents("php://input"), true)).
Can't find any soultion about this.

Im writing data to file like (file_put_contents('bot_'.time().'.txt', print_r($data, true));) this and file is empty.

Can you please help me?

Webview not supported ?

I am trying to open a webview using this sdk , but it does not work . Are you planning on implementing this feature ?

Class 'pimax\Messages\Attachment' not found

Hello Sir,
when i type "image" to send one photo from url to User, i see a issues with log

[15-Jan-2017 12:31:33 Asia/Ho_Chi_Minh] PHP Fatal error: Class 'pimax\Messages\Attachment' not found in /home/xxxx/public_html/xxxxxxx/Messages/ImageMessage.php on line 49

how to fix it. please

greeting thread

Thanks for your effort to build this! :)

I've got this submiting a review for my bot:

To help us review your messenger experience, please resubmit with conversation starters and expected responses in the relevant language. Please submit in this format: 
A: Conversation starter (in the relevant language)
B: Expected response from the business 
A: Conversation starter #2 
B: Expected response #2

Actually it's just as simple as conversation starter. You can take a look at this: https://developers.facebook.com/docs/messenger-platform/thread-settings

will you build a greeting thread model?

Image in a structured message

Hi
How do we include a image URL in a structured image ?

And the default messenger function to send an image doesn't work
$bot->send(new ImageMessage($message['sender']['id'], 'https://developers.facebook.com/images/devsite/fb4d_logo-2x.png'));

Problem with structured message

Hi, thanks for this implementation to facebook bot. I try the example and the structured message is not working for me. Work for you?
Thanks!

Upload Image in Generic

How can i add an image before the title('eg:First item') in this structured message?

$bot->send(new StructuredMessage($message['sender']['id'],
StructuredMessage::TYPE_GENERIC,
[
'elements' => [
new MessageElement("First item", "Item description", "", [
new MessageButton(MessageButton::TYPE_POSTBACK, 'First button'),
new MessageButton(MessageButton::TYPE_WEB, 'Web link', 'http://facebook.com')
]),

I wish to get the content like:an image ,title,description and then a button.

problem with structured message -PHP- bot messenger

hi!
i have a problem with my bot..
i don't know how i insert a code of a structured message in my bot PHP.

i need help to create a form for a structured message.

can you create a structured message, one of a kind, for this code?
copy, insert and past in the next comment.thanks

the rest perfect works...

this is the code:

[ 'id' => $senderId ], 'message' => [ 'text' => $answer ] ]; $ch = curl_init('https://graph.facebook.com/v2.6/me/messages?access_token='.$accessToken); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($response)); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); curl_exec($ch); curl_close($ch);

Messenger Platform released v1.4

Greeting guys,
is it possible to create a project on the repository so we can avoid work duplication?

according to https://developers.facebook.com/docs/messenger-platform/changelog major changes done by FB team.

thread_settings is dropped and replaced by messenger_profile and the json structure for persistent menus and greeting message has changed.

I will be working on both of them and I hope to finish this by end of Friday or something. If someone is working to upgrade another part affected by v1.4 please leave a reply so we avoid duplication and wasted effort.

pimax\Messages\ImageMessage' not found in /app/index.php:68

hello , very nice your example , I immediately wanted to do a test ...
I mounted on heroku , but I have this problem on ImageMessage :

2016-06-01T19:11:51.946371+00:00 app[web.1]: [01-Jun-2016 19:11:51 UTC] PHP Fatal error: Uncaught Error: Class 'pimax\Messages\ImageMessage' not found in /app/index.php:68

text work fine ...

Can help me ?? tnks

how can i create my own functions ?

i am trying to make a new function in UserProfile.php

but it show me that message

Could not write “/home/........../UserProfile.php”: Permission denied

how can i do this ?

Link previews in the bot messages

I want to send simple article title with URL after it. I have implemented that, but I don't see URL preview in the messages (like in Telegram bot).

How can I enable URL previews in Facebook messenger with your lib?

Button POSTBACK array

Require something like this
new MessageButton(MessageButton::TYPE_POSTBACK, 'Create', ['action'=>'create', 'param1'=>'param1'] )

quick replies issue

QuickReply class the line:

foreach ($this->quick_replies as $qr) {
            $result['message']['quick_replies'][] = $qr->getData();
}

is breaking all previously created quick replies!
we used to send associative array contains the quick replies data and now you expect array of quick reply buttons.

Do you really want everyone to refactor his code when he needs to update?

Undefined index: first_name

Hi, when i use the function FbBotApp::userProfile($messenger_id)
my script stops with the error:

[ErrorException]
Undefined index: first_name

How do i use FbBotApp::userProfile witouth stop my script?

video

I'm uploading files to my website. I did not try upload direct to Messenger Plataform.
if I did not try upload direct to Messenger Plataform,there are proplem:
the callback video is too slow!!!!!!!!!
help!!!!!!!!

unable to upload image from local computer

Sending image using url works ok. But while uploading image from local computer, receive an error {"error":{"message":"(#100) The parameter message[attachment][payload] is required","type":"OAuthException","code":100,"fbtrace_id":"FFaO+JohtCZ"}}

How can I make generic structured message with many elements?

Hi, really stuck on this one,.. I do a normal curl, but fb shows recipient required even though I've done all correctly. so I have to use your libs.

but the problem is how can I populate elements, it's impossible for me to create MessegeElement everytime inside the loop. thanks

StructuredMessage not sending response

Hi, I'm looping my data into an array_list then I set the StructuredMessage but it doesn't send the response to my FB Messenger Bot.
I logged the array_list (each one is a MessageElement) and this is the output for each element result:

    [18] => pimax\Messages\MessageElement Object
        (
            [title:protected] => Dutch Negroni
            [image_url:protected] => http://mydomain.com/dutch-negroni1.jpg
            [subtitle:protected] => 
            [buttons:protected] => Array
                (
                    [0] => pimax\Messages\MessageButton Object
                        (
                            [type:protected] => web_url
                            [title:protected] => Readmore
                            [url:protected] => http://mydomain.com/dutch-negroni-2/
                        )
            )

    )

I'd like you feedback to solve this or how can it debug this?
Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.