GithubHelp home page GithubHelp logo

fbmessenger's People

Contributors

danfairs avatar edison12a avatar elinguiuriel avatar jacquerie avatar noamkush avatar rickydunlop avatar tirkarthi avatar wittfabian 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

fbmessenger's Issues

Answer concurrent messages

Hi everyone, first of all thank you in advance for your patience. I have a question: I noticed that using standard Flask configuration (as in the example), the library processes one message at a time. Therefore, I changed Flask WSGI server to gevent, to handle multiple concurrent connections. However, if two users send concurrent messages, the answers seem to be randomly mixing up. I noticed that send method of BaseMessenger class uses last_message, which doesn't seem to be thread-safe. Therefore, in the class extending BaseMessenger class, I implemented some sort of override of the send method like this:

    def raw_send(self, recipient_id, message_data, messaging_type='RESPONSE', tag=None):
        self.client.send(payload=self.build_message_template(message_data), 
                         entry={"sender": {"id": recipient_id}},
                         messaging_type=messaging_type,
                         tag=tag)

Did I do the right thing? Is there a way to use the library with concurrent requests? At the moment I am using fbmessenger 5.3.2. I hope my question isn't stupid. Thank you again.

Post response time

Using the method fbmessenger.send() I have a very slow response time (~ 800ms), has anybody encountered that before ?
I am having decent response (~80ms) time with slack on the same platform, so I am sure it doesn't come from my connection.

Sending multiple text responses

Hi, I need to send the reply back to facebook as 2 different messages. How can i handle this?

response = Text(text='Sorry, I am not able to answer for your queries right now.')

I need Sorry and I am not able to answer for your queries right now. as two different messages.

Please help.

API version

How to set Facebook messenger API version ?

Update README.md

  • add app_secret
  • add api version
  • update "Create a route for the callback url"
  • remove NON_PROMOTIONAL_SUBSCRIPTION

update "Create a route for the callback url":
messenger = Messenger(os.environ.get('FB_VERIFY_TOKEN'),os.environ.get('FB_PAGE_TOKEN'))

should be

messenger = Messenger(os.environ.get('FB_PAGE_TOKEN'))

What is the right syntax for calling async functions?

Would you like assistance or advice?
assistance

Issue description
in the example below, trying to call an async function from within "def message(self, message):"

Steps to reproduce
insert "await inside the "def message(self, message):" where is a function defined as async

Traceback or other info

  • fbmessenger version: latest
  • python version: 3.7.3
  • Facebook Messenger API version: 11.0

error in response of init_bot()

[2018-08-29 04:53:10,185] DEBUG in bot: Response: {'error': {'message': '(#100) Requires one of the params: get_started,persistent_menu,target_audience,whitelisted_domains,greeting,account_linking_url,payment_settings,home_url', 'type': 'OAuthException', 'code': 100, 'fbtrace_id': 'FncS+nanDCj'}}

Is there a way to send local file?

Would you like assistance or advice?

advice

Issue description

Would like to send a file from a local filesystem.

file = attachments.File(url="file://./file.txt")
client.send(file.to_dict(), recipient_id=user_id, messaging_type='RESPONSE')

Steps to reproduce

the above code returns "(#100) file://./file.txt should represent a valid URL)"
also tried other variations of file:// syntax as well as simply ./file.txt and file.txt

Traceback or other info

  • fbmessenger version: master@commit
  • python version: 3.7
  • Facebook Messenger API version: 13

Thanks!

Sending a message to a specific user by ID

Would you like assistance or advice?
Assistance.
Issue description
I can't seem to be able to send a message to a specific user after getting his ID
Steps to reproduce
I get the recipient_id through sender=self.get_user_id()
Then why I try to use self.send({'text': "msg"}, sender, 'RESPONSE') it fails with the error:
ValueError: '2595091087229339' is not a valid 'messaging_type'
It seems like it's handling the variable sender as if it's the messaging_type not recipient_id
Any idea what am I doing wrong?

  • fbmessenger version: 6.0.0 / master@commit
  • python version: 3.7.1

How to send Youtube Videos as Message

Sending videos is as simple as adding the URL with .mp4 extension. But most of us share youtube videos across messenger.

So how can we send a Youtube video other than sending as a URL?

Infinite loop

hi there,

I'm using the example, but I'm getting a loop at the messages. I send "video", then I receive thousands of video responses. Also, the example doesn't cover the message_type. I've put a fixed "RESPONSE" there.

Or else I get TypeError: send() missing 1 required positional argument: 'messaging_type'

Fetching User Information

Can anyone brief me on getting user information of the sender?
Details Such as Name, Location etc.

Django integration

I have a django project and I will like to build a chatbot for it, but instead of running a different flask server i would like to build a new app inside the project with the bot functionality, any idea of how to do this?

Sending multiple images as a group

Would you like assistance or advice?
Advice, please!

Issue description
When I drag and drop multiple images to a facebook messenger, they are sent as a group

Screen Shot 2021-09-12 at 2 13 31 PM

How do I do this as a bot?

Steps to reproduce
NA

Traceback or other info
NA

  • fbmessenger version: latest / master@commit
  • python version: 3.7
  • Facebook Messenger API version: 11

Keep getting the same message from messenger

fbmessenger version 5.0.0
I am using Rasa-core which uses the fbmessenger as facebook connector, Issue is when my bot takes long time to respond which usually happens when some API is being called I start getting the same message back from messenger no mattter what is being typed by user .So I searched a bit and I came to this conclusion that facebook sends the same message when it doesn't get a response in few seconds .OR it may be due to my localtunnel being patchy.

Send Image with caption

Hi, there and thank you for your library!

Currently, there is no way to add text to an image. Can it be implemented in the future versions? Thanks

class Image(BaseAttachment):
    def __init__(self, url=None, is_reusable=None, quick_replies=None, attachment_id=None):
        self.attachment_type = 'image'
        self.url = url
        self.is_reusable = is_reusable
        self.quick_replies = quick_replies
        self.attachment_id = attachment_id
        super(Image, self).__init__(self.attachment_type, self.url, self.is_reusable,
                                    self.quick_replies, self.attachment_id)

Allow Messaging with Tags in messenger.send(...)

The BaseMessenger.send instance method doesn't take in a message tag parameter which is required when the messaging_type is "MESSAGE_TAG". As per the FB Docs, we should allow an extra optional parameter to the send method called tag which gets sent in the request body when the messaging_type is "MESSAGE_TAG".

Without this, we are not able to use this library for proactively messaging the users.

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.