Skip to content

Commit

Permalink
[RELEASE] Bump to 1.1.6 (#70)
Browse files Browse the repository at this point in the history
* [IMP] Add argument reusable in send_file & send_file_url
* [ADD] send_attachment SEND API (sending reusable file)
* [FEAT] Personas management send API (create, list, get, delete) by @rivo2302
* [ADD] new messenger api : send receipt template by @rootkit7628
* [FIX] attachments not received in function reported by @SergioDev22
* [IMP] unit test for receiving attachment
* [ADD] decorator before_receive & after_receive message
* [ADD] get_user_profile SEND API
  • Loading branch information
gaetan1903 authored Dec 1, 2022
1 parent 7dbf105 commit 8c1b27d
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 5 deletions.
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,18 @@
* [ADD][IMP] Full functionnality `send_message` API (#63)
* [ADD] Unit Test for messenger_api
* [ADD] Unit Test for ampalibe CLI
* [IMP] Documentation improved
* [IMP] Documentation improved


## Ampalibe 1.1.6

* [IMP] Add argument reusable in send_file & send_file_url
* [ADD] send_attachment SEND API (sending reusable file)
* [FEAT] Personas management send API (create, list, get, delete) by @rivo2302
* [ADD] new messenger api : send receipt template by @rootkit7628
* [FIX] attachments not received in function reported by @SergioDev22
* [IMP] unit test for receiving attachment
* [ADD] decorator before_receive & after_receive message
* [ADD] get_user_profile SEND API


2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
It provides a new concept, it manages webhooks, processes data sent by Facebook and provides <a href="https://developers.facebook.com/docs/messenger-platform/">API Messenger</a> with advanced functions such as payload management, item length, and more.
</p>

<a href='https://github.com/iTeam-S/Ampalibe/#'><img src='https://img.shields.io/badge/version-1.1.6dev-%23008080'/></a>
<a href='https://github.com/iTeam-S/Ampalibe/#'><img src='https://img.shields.io/badge/version-1.1.6-%23008080'/></a>
<a href='https://ampalibe.readthedocs.io/en/latest/'><img src='https://readthedocs.org/projects/ampalibe/badge/?version=latest&style=flat'/></a>
<a href='https://github.com/iTeam-S/Ampalibe/actions/workflows/ci.yml'><img src='https://github.com/iTeam-S/Ampalibe/actions/workflows/ci.yml/badge.svg'/></a>
<a href='https://github.com/iTeam-S/Ampalibe/actions/workflows/cd-pg.yml'><img src='https://github.com/iTeam-S/Ampalibe/actions/workflows/cd-pg.yml/badge.svg'/></a>
Expand Down
2 changes: 1 addition & 1 deletion ampalibe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from .source import conf, core, langs


__version__ = "1.1.6dev"
__version__ = "1.1.6"
__author__ = "iTeam-$"


Expand Down
12 changes: 12 additions & 0 deletions ampalibe/messenger.py
Original file line number Diff line number Diff line change
Expand Up @@ -798,3 +798,15 @@ def send_receipt_template(
self.url + "/messages", json=dataJSON, headers=header, params=params
)
return self.__analyse(res)

@retry(requests.exceptions.ConnectionError, tries=3, delay=3)
def get_user_profile(self, dest_id, fields='first_name,last_name,profile_pic'):
"""
The User Profile methiod allows you to use a Page-scoped ID (PSID)
to retrieve user profile information that can be used to personalize
the experience of people interacting with your Messenger.
"""
params = {"fields": fields, "access_token": self.token}
res = requests.get(f'https://graph.facebook.com/{dest_id}', params=params)

return res.json() if res.status_code == 200 else {}
Binary file added docs/source/_static/personas.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions docs/source/messenger.rst
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ _________________
The Messenger Platform allows you to create and manage personas for your business messaging experience. The persona may be backed by a human agent or a bot. A persona allows conversations to be passed from bots to human agents seemlessly.
When a persona is introduced into a conversation, the persona's profile picture will be shown and all messages sent by the persona will be accompanied by an annotation above the message that states the persona name and business it represents.

.. image:: https://raw.githubusercontent.com/iTeam-S/Ampalibe/main/docs/source/_static/personas.png

Method to create personas

Expand Down Expand Up @@ -553,3 +554,31 @@ Method to delete personas
chat.delete_personas('123456789')
get_user_profile
_________________

Method to get specific personas

**Ref**: https://developers.facebook.com/docs/messenger-platform/identity/user-profile

**Args**:

*dest_id (str)*: user id for destination

*fields (str)*: list of field name that you need. Defaults to "first_name,last_name,profile_pic"

**Response**:

*dict*: user info

**Example**:

.. code-block:: python
from ampalibe import Messenger
chat = Messenger()
user_info = chat.get_user_profile(sender_id)
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = Ampalibe
version = 1.1.6dev
version = 1.1.6
author = iTeam-$
author_email = [email protected]
description = Ampalibe is a lightweight Python framework for building Facebook Messenger bots faster.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="ampalibe", # This is the name of the package
version="1.1.6dev", # The release version
version="1.1.6", # The release version
author="iTeam-$", # Full name of the author
description="Ampalibe is a lightweight Python framework for building Facebook Messenger bots faster.",
long_description=long_description, # Long description read from the readme
Expand Down

0 comments on commit 8c1b27d

Please sign in to comment.