ker0x / messenger Goto Github PK
View Code? Open in Web Editor NEW💬 A PHP library for Facebook Messenger
License: MIT License
💬 A PHP library for Facebook Messenger
License: MIT License
As described here
Can see from: cf773c1 Guzzle has been bumped to v7. Packagist defaults to 3.4 release which only has Guzzle 6.2 and causes compatibility issues. Are we able to get an updated release with these library bumps, please?
Description
Facebook update available Tags and depreceated some other one.
Deprecreated tags will be remove the 4 march 2020
Add ACCOUNT_UPDATE
, PAYMENT_UPDATE
and PERSONAL_FINANCE_UPDATE
tag to send API
Notice: Undefined index: app_id /vendor/kerox/messenger/src/Model/Callback/MessageEcho.php
on line 86
It happen when the app subscribed to echo messages, and the user click on "Send Message" on a page's post. Facebook then sends the post as a message, and that's probably why the app_id doesn't exist.
Here is an example of data:
{"object":"page","entry":[{"id":"123456789","time":987654321,"messaging":[{"sender":{"id":"123456789987654321"},"recipient":{"id":"987654321123456789"},"timestamp":1503948277841,"message":{"is_echo":true,"mid":"mid.$XXXXXXXXX","seq":100000,"attachments":[{"title":"Here is an example","url":null,"type":"template","payload":null}]}}]}]}
Description
In addition to entities nlp return traits and dected locales we nedd to add those to the callback message as there is no existing way to access those fields
As soon as the PSR-18 will be accepted, we need to:
guzzlehttp/guzzle
from required packagepsr/http-client
insteadClientInterface
Tried to send message with tag
$messenger->send()->message('', '', Send::NOTIFICATION_TYPE_REGULAR, Send::TAG_ISSUE_RESOLUTION);
I got error
Fatal error: Uncaught GuzzleHttp\Exception\ClientException: Client error: POST https://graph.facebook.com/v2.11/me/messages?access_token=
resulted in a 400 Bad Request
response:
{"error":{"message":"(#100) Messaging type should be MESSAGE_TAG for tagged messages.","type":"OAuthException","code":10 (truncated...)
in /vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113
I don't know whether i made mistake in my code. but it looks like messaging_type is not set correctly so i reported it.
In UserResponse class the datatype of timezone is int. But I get my timezone as 5.5 (+5:30). So the datatype of timezone may be float. I got error as
PHP Fatal error: Uncaught TypeError: Return value of Kerox\Messenger\Response\UserResponse::getTimezone() must be of the type integer or null, float returned in /vendor/kerox/messenger/src/Response/UserResponse.php:105
Could you implement persistent menus as described here ?
I am using your sdk with laravel 5.5 and getting following error..
error.json.log
Description
I am trying to send a message with a user_ref
string (received from Messenger Checkbox), this is not possible though, because the constructed message has pretty much hardcoded recipient
with id
key.
Example
It could be perhaps done just by removing type string
for $recipient from message on Send and ?string
type in the constructor of SendRequest.
Then the following should work:
$messenger->send()->message(['user_ref' => $recipient], $message);
And the constructed message would comply with the format specified here.
{
"recipient": {
"user_ref":"<UNIQUE_REF_PARAM>"
},
"message": {
"text":"hello, world!"
}
Sometimes a user may want to send the text "0", which is detected as empty in this line: https://github.com/ker0x/messenger/blob/master/src/Model/Callback/Message.php#L85
I'm not sure it's the expected behaviour (even if it's PHP's empty
normal behaviour) in a chat situation.
Probably if it's a Message event, it means that there is at least at text and we shouldn't even test hasText
. Is it sure enough to trust that? Or is it possible that there are only attachments without text?
Thread API as been renamed to Messenger Profile with major changements
It seems that paths like /me/messages
are transformed to https://graph.facebook.com/me/messages
instead of https://graph.facebook.com/v2.6/me/messages
. It caused me a problem that was solved that way, by hardcoding version number
As far as I know, it's GuzzleHttp that make this uri conversion.
The simple version would be to set base_uri
to self::API_URL.self::API_VERSION.'/'
and change routes to me/messages
(relative path) instead of /me/messages
(from domain root)
Is there a cleaner way to do it?
{
"error": {
"code": 100,
"fbtrace_id": "BZ/wICPbDw9",
"message": "(#100) Invalid tag.",
"type": "OAuthException"
}
}
Hello,
I am currently working on a project using your bundle
We have a problem with quick replies that no longer call their callback function since the beginning of this month of August.
While looking in our logs, we could see the following error:
[2019-08-19 15:29:11] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: “Type error: Argument 2 passed to Kerox\Messenger\Model\Callback\Message::__construct() must be of the type integer, null given, called in /var/www/v2/releases/448/vendor/kerox/messenger/src/Model/Callback/Message.php on line 157” at /var/www/v2/releases/448/vendor/kerox/messenger/src/Model/Callback/Message.php line 49 {“exception”:“[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Type error: Argument 2 passed to Kerox\Messenger\Model\Callback\Message::__construct() must be of the type integer, null given, called in /var/www/v2/releases/448/vendor/kerox/messenger/src/Model/Callback/Message.php on line 157 at /var/www/v2/releases/448/vendor/kerox/messenger/src/Model/Callback/Message.php:49)“} []
At the root of the problem would be an update of Messenger that would no longer use the ‘seq’ parameter:
« Effective as of today, the parameter seq will always be 0 for all Messenger webhook events. This deprecation was announced on November 8, 2016. After Jul 31, 2019 the seq parameter will no longer be included in webhook events. To de-duplicate messages use the mid parameter. »
--> https://developers.facebook.com/docs/messenger-platform/changelog
This is the reason why the bundle should be updated so that this parameter will no longer be present or will be modified and that the quick replies return to normal operation.
As mentionned here, the current version of the API is 2.8
Hi Mr Ker0x i hope you doing well,
Sir we are using ker0x messenger sdk and our team having object instantiate problem. Let me explain
In figure 1.1
you can see that we are ceating 2 objects
$messenger1
(on line 33)
$messenger2
(on line 34)
with pageToken
abc
(on line 33)
xyz
(on line 34)
respectively.
Then we simple var_dump the objects on line number 40 and 49 respectively.
In figure 1.2
you can see the results that we are having same pageToken
for both objects i.e. pageToken
is abc
for $messenger1
and $messenger2
, for $messenger2
it should be xyz
So we debug the problem and found some piece of code that may be creating the problem i.e. in figure 1.3 you can see code snippet
In this code you are saving instance in static variable $_instance
which doesn't get reinitialize while creating new object.
so i hope you can understand the problem and will be fixing it soon.
PS: problem persists in both versions i.e. 1.x and 2.x and we are using version 1.4
best Regards
FYI, it's possible that a Postback event doesn't contain payload. For instance when standby
webhook is set, we may also receive this event:
{
"object": "page",
"entry": [
{
"id": "270383946729865",
"time": 1504876176615,
"standby": [
{
"recipient": {
"id": "270383946729865"
},
"timestamp": 1504876176615,
"sender": {
"id": "1260743020679416"
},
"postback": {
"title": "Details"
}
}
]
}
]
}
When someone click on a list's button, it will send the normal event (with payload), and also the standby one.
It may cause a problem there: src/Model/Callback/Postback.php
on line 62
It's not important in my case, I simply deactivated the standby webhook. Just wanted to let you know about it.
As described here
[2018-01-16 12:56:39] lumen.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError:
Parse error: syntax error, unexpected 'const' (T_CONST), expecting variable (T_VARIABLE) in
C:\xampp2\htdocs\faceman\vendor\kerox\messenger\src\Messenger.php:23
Code Line:
class Messenger
{
public const API_URL = 'https://graph.facebook.com/';
public const API_VERSION = 'v2.11';
/**
* @var string
*/
I'd fix this myself and submit a pull request but I'm not very handy with regex and wouldn't want to muck things up...
I'm running into situations where urls with subdomains are coming back as invalid URLs from the isValidUrl method linked below - is this intended?
messenger/src/Helper/ValidatorTrait.php
Line 49 in 6bc832a
As described here
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.