sns-sdks / python-facebook

A simple Python wrapper for facebook graph api :sparkles: :cake: :sparkles: .
https://sns-sdks.github.io/python-facebook/
322 stars 84 forks source link

Send a Basic Text can not tto send from pyfacebook #250

Open Antonkoch999 opened 7 months ago

Antonkoch999 commented 7 months ago

I try to send text message with help this enpount: https://developers.facebook.com/docs/messenger-platform/send-messages/

but if I do

        data = {"recipient": {"id": recipient_id}, "message": {"text": message}}
        return GraphAPI(
            app_id=settings.FACEBOOK_APP_ID,
            app_secret=settings.FACEBOOK_APP_SECRET_KEY,
            access_token=access_token,
            version=self.version,
        ).post_object(object_id=page_id, connection="messages", data=data)

I have a problem, recipient is empty, because if I send data=data, {"recipient": {"id": recipient_id}} become recipient=id