Repository: line/line-bot-sdk-python
Pull request #305 (2020-12-05 17:43:02)

feat: Support sticker message keywords
Spec: https://developers.line.biz/en/reference/messaging-api/#wh-sticker
December news: https://developers.line.biz/en/news/2020/12/02/messaging-api-update-december-2020/

CLAassistant: [![CLA assistant check](https://cla-assistant.io/pull/badge/not_signed)](https://cla-assistant.io/line/line-bot-sdk-python?pullRequest=305) <br/>Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our [Contributor License Agreement](https://cla-assistant.io/line/line-bot-sdk-python?pullRequest=305) before we can accept your contribution.<br/><hr/>**NiJia** seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please [add the email address used for this commit to your account](https://help.github.com/articles/why-are-my-commits-linked-to-the-wrong-user/#commits-are-not-linked-to-any-user).<br/><sub>You have signed the CLA already but the status is still pending? Let us [recheck](https://cla-assistant.io/check/line/line-bot-sdk-python?pullRequest=305) it.</sub>

Patch:
diff --git a/linebot/models/messages.py b/linebot/models/messages.py
index 32ddb83..39f7c42 100644
--- a/linebot/models/messages.py
+++ b/linebot/models/messages.py
@@ -189,13 +189,14 @@ class StickerMessage(Message):
     """
 
     def __init__(self, id=None, package_id=None, sticker_id=None,
-                 sticker_resource_type=None, **kwargs):
+                 sticker_resource_type=None, keywords=None, **kwargs):
         """__init__ method.
 
         :param str id: Message ID
         :param str package_id: Package ID
         :param str sticker_id: Sticker ID
         :param str sticker_resource_type: Sticker resource type
+        :param list[str] keywords: List of up to 15 keywords describing the sticker
         :param kwargs:
         """
         super(StickerMessage, self).__init__(id=id, **kwargs)
@@ -204,6 +205,7 @@ class StickerMessage(Message):
         self.package_id = package_id
         self.sticker_id = sticker_id
         self.sticker_resource_type = sticker_resource_type
+        self.keywords = keywords
 
 
 class FileMessage(Message):


Test patch:
diff --git a/tests/test_webhook.py b/tests/test_webhook.py
index e2d17c5..e9845ed 100644
--- a/tests/test_webhook.py
+++ b/tests/test_webhook.py
@@ -168,6 +168,8 @@ class TestWebhookParser(unittest.TestCase):
         self.assertEqual(events[5].message.package_id, '1')
         self.assertEqual(events[5].message.sticker_id, '1')
         self.assertEqual(events[5].message.sticker_resource_type, 'STATIC')
+        self.assertEqual(events[5].message.keywords[0], 'Love You')
+        self.assertEqual(events[5].message.keywords[1], 'Love')
 
         # FollowEvent, SourceUser
         self.assertIsInstance(events[6], FollowEvent)
diff --git a/tests/text/webhook.json b/tests/text/webhook.json
index d4ff25d..ba60141 100644
--- a/tests/text/webhook.json
+++ b/tests/text/webhook.json
@@ -106,7 +106,8 @@
         "type": "sticker",
         "packageId": "1",
         "stickerId": "1",
-        "stickerResourceType": "STATIC"
+        "stickerResourceType": "STATIC",
+        "keywords": ["Love You", "Love"]
       }
     },
     {