{ "info": { "author": "Peter Dinh", "author_email": "peterdinh018@gmail.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "Intended Audience :: Information Technology", "License :: OSI Approved :: BSD License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "# python-chatfuel-class\n\n## Descrpition: Python Wrapper for JSON API Chatfuel\n##### This project was inspired by [php-chatfuel-class](https://github.com/J2TEAM/php-chatfuel-class)\n\n## Functions List:\n* Send Text:\n```python\ndef sendText(self, messages = None)\n```\n* Send Image\n```python\ndef sendImage(self, url_image)\n```\n* Send Audio\n```python\ndef sendAudio(self, url):\n```\n* Send Video\n```python\ndef sendVideo(self, url)\n```\n* Send Text Card\n```python\ndef sendTextCard(self, text, buttons)\n```\n* Send Gallery\n```python\ndef sendGallery(self, elements)\n```\n* Send List\n```python\ndef sendList(self, elements)\n```\n* Send Quick Reply\n```python\ndef sendQuickReply(self, text, quickReplies)\n```\n* Create Element\n```python\ndef createElement(self, title, image, subTitle, buttons)\n```\n\n* Create Button To Block\n```python\ndef createButtonToBlock(self, title, block, setAttributes = None)\n```\n* Create Button To URL\n```python\ndef createButtonToURL(self, title, url)\n```\n* Create PostBack Button\n```python\ndef createPostBackButton(self, title, url_plugin)\n```\n* Create Call Button\n```python\ndef createCallButton(self, title, phoneNumber)\n```\n* Create Share Button\n```python\ndef _createShareButton(self)\n```\n* Create Attachment\n```python\ndef createAttachment(self, _type, payload)\n```\n\n### You can see the code at here [class_chatfuel.py](class-chatfuel-python/class-cchatfuel.py)\n\n## Installation\n\n##### For python 2x\n```shell\npip install python_chatfuel_class\n```\n\n##### For python 3x\n```shell\npip3 install python_chatfuel_class\n```\n\n## Usage\n* Send Text:\n```python\n@app.route('/sendText/')\ndef sendText(text):\n chatfuel = Chatfuel()\n chatfuel.sendText(text)\n return chatfuel.get_response()\n```\n![send-text](https://peter-dinh.github.io/python-chatfuel-class/img/sendText.png)\n\n* Send Image:\n```python\n@app.route('/sendImage/')\ndef sendImage():\n chatfuel = Chatfuel()\n url_image = ''\n chatfuel.sendImage(url_image)\n return chatfuel.get_response()\n```\n![send-Image](https://peter-dinh.github.io/python-chatfuel-class/img/sendImage.png)\n\n* Send Audio:\n```python\n@app.route('/sendAudio/')\ndef sendAudio():\n chatfuel = Chatfuel()\n url_audio = ''\n chatfuel.sendAudio(url_audio)\n return chatfuel.get_response()\n```\n![send-Audio](https://peter-dinh.github.io/python-chatfuel-class/img/sendAudio.png)\n\n* Send Video:\n```python\n@app.route('/sendVideo/')\ndef sendVideo():\n chatfuel = Chatfuel()\n url_video = ''\n chatfuel.sendVideo(url_video)\n return chatfuel.get_response()\n```\n![send-Video](https://peter-dinh.github.io/python-chatfuel-class/img/sendVideo.png)\n\n* Send Button to Block:\n```python\n@app.route('/sendTextCard/ButtonToBlock')\ndef createButtonToBlock():\n chatfuel = Chatfuel()\n ButtonToBlock = chatfuel.createButtonToBlock(\n 'Button To Block',\n ['#block_1', '#block_2'],\n {'setAttribute_1': 'value_1'}\n )\n chatfuel.sendTextCard('Clicking the button below!', [ButtonToBlock])\n return chatfuel.get_response()\n```\n![Button to Block](https://peter-dinh.github.io/python-chatfuel-class/img/buttontoBlock.png)\n\n* Send Button to URL:\n```python\n@app.route('/sendTextCard/ButtonToURL')\ndef ButtonToURL():\n chatfuel = Chatfuel()\n ButtonToURL = chatfuel.createButtonToURL(\n 'Button To URL',\n 'url_website',\n )\n chatfuel.sendTextCard('Clicking the button below!', [ButtonToURL])\n return chatfuel.get_response()\n```\n![Button To URL](https://peter-dinh.github.io/python-chatfuel-class/img/buttontoURL.png)\n\n* Send Button Post Back:\n```python\n@app.route('/sendTextCard/PostBackButton')\ndef PostBackButton():\n chatfuel = Chatfuel()\n PostBackButton = chatfuel.createPostBackButton(\n 'Post Back Button',\n 'url_plugin',\n )\n chatfuel.sendTextCard('Clicking the button below!', [PostBackButton])\n return chatfuel.get_response()\n```\n![PostBack Button](https://peter-dinh.github.io/python-chatfuel-class/img/buttontopostback.png)\n\n* Send Button Call:\n```python\n@app.route('/sendTextCard/CallButton')\ndef CallButton():\n chatfuel = Chatfuel()\n CallButton = chatfuel.createCallButton(\n 'Call Button',\n 'Phone_number', #example; +84919666666\n )\n chatfuel.sendTextCard('Clicking the button below!', [CallButton])\n return chatfuel.get_response()\n```\n![Call Button](https://peter-dinh.github.io/python-chatfuel-class/img/buttoncall.png)\n\n* Send Gallery:\n```python\n@app.route('/sendGallery/')\ndef sendGallery():\n chatfuel = Chatfuel()\n elements = []\n #maximum 3 button\n button_access_url = chatfuel.createButtonToURL('Access Website', 'https://www.google.com.vn')\n button_call = chatfuel.createCallButton('+84919666666')\n button_share = chatfuel.createShareButton()\n title = 'Send Gallery'\n image_url = ''\n subTitle = 'subTitle Item'\n for i in range(5):\n elements.append(chatfuel.createElement(title, image_url, subTitle, [button_access_url, button_call, button_share]))\n chatfuel.sendGallery(elements)\n return chatfuel.get_response()\n```\n![send-Gallery](https://peter-dinh.github.io/python-chatfuel-class/img/gallery.png)\n\n* Send List:\n```python\n@app.route('/sendList/')\ndef sendList():\n #minimum 2 items in one List (Elements)\n #maximum 4 items in one List (Elements)\n chatfuel = Chatfuel()\n elements = []\n button_access_url = chatfuel.createButtonToURL('Access Website', 'https://www.google.com.vn')\n title = 'Send List'\n image_url = ''\n subTitle = 'subTitle Item'\n for i in range(2):\n elements.append(chatfuel.createElement(title, image_url, subTitle, [button_access_url]))\n chatfuel.sendList(elements)\n return chatfuel.get_response()\n\n```\n![send-List](https://peter-dinh.github.io/python-chatfuel-class/img/sendList.png)\n\n* Send Quick Reply:\n```python\n@app.route('/sendQuickReply/')\ndef sendQuickReply():\n chatfuel = Chatfuel()\n button_quick_replies_attributes = chatfuel.createButtonToBlock(\n 'Send Quick Reply',\n ['#block_1'],\n {'setAttributes_1': 'value_1'},\n )\n button_quick_replies = chatfuel.createButtonToBlock('Title', ['#block_1'])\n chatfuel.sendQuickReply('Text', [button_quick_replies_attributes, button_quick_replies])\n return chatfuel.get_response()\n```\n![send-Quick-Reply](https://peter-dinh.github.io/python-chatfuel-class/img/quickreply.png)\n\n* Redirect Block\n```python\n@app.route('/redirectBlock/')\ndef redirectBlock():\n return json.dumps({\"redirect_to_blocks\": [\"Welcome message\", \"Default answer\"]})\n```\n![Redirect Block](https://peter-dinh.github.io/python-chatfuel-class/img/redirectblock.png)\n\n\n## Demo:\n* [BotChat VietNam](https://m.me/2059865890937967)\n\n* [Learn English with Botchat](https://m.me/267955540449392)\n\n* [Peter Dinh](https://m.me/bot.peter.com.vn)\n## Author: [@Peter Dinh](https://github.com/peter-dinh)\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/peter-dinh/class-chatfuel-python", "keywords": "Package for Chatfuel", "license": "BSD 3-Clause", "maintainer": "", "maintainer_email": "", "name": "python-chatfuel-class", "package_url": "https://pypi.org/project/python-chatfuel-class/", "platform": "", "project_url": "https://pypi.org/project/python-chatfuel-class/", "project_urls": { "Homepage": "https://github.com/peter-dinh/class-chatfuel-python" }, "release_url": "https://pypi.org/project/python-chatfuel-class/2.1.3/", "requires_dist": [ "urllib3" ], "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*", "summary": "Python Wrapper for JSON API Chatfuel", "version": "2.1.3" }, "last_serial": 4066930, "releases": { "2.1.3": [ { "comment_text": "", "digests": { "md5": "64cb2786f84cffe93fbc6488b05ce814", "sha256": "246e1c7d0c39897d6752ccbeeb14f835a86b1711e765358df1af4bb797bae121" }, "downloads": -1, "filename": "python_chatfuel_class-2.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "64cb2786f84cffe93fbc6488b05ce814", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*", "size": 4874, "upload_time": "2018-07-16T19:36:15", "url": "https://files.pythonhosted.org/packages/3d/36/f3bd577bd581b1f1137aa388a06fec6343829bde308c7ff5bf410f4b40de/python_chatfuel_class-2.1.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "aa05d13e8441fdc5470901baf32e9c64", "sha256": "e19678ae7d1cbac333e4ec8f7bd2664a5863168d2193b8fe744b8f5f23a33c81" }, "downloads": -1, "filename": "python_chatfuel_class-2.1.3.tar.gz", "has_sig": false, "md5_digest": "aa05d13e8441fdc5470901baf32e9c64", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*", "size": 4848, "upload_time": "2018-07-16T19:36:18", "url": "https://files.pythonhosted.org/packages/37/41/630970fc26adb50c9f1220de106e0321f64536d30c62a4002cdbe2ae81c0/python_chatfuel_class-2.1.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "64cb2786f84cffe93fbc6488b05ce814", "sha256": "246e1c7d0c39897d6752ccbeeb14f835a86b1711e765358df1af4bb797bae121" }, "downloads": -1, "filename": "python_chatfuel_class-2.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "64cb2786f84cffe93fbc6488b05ce814", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*", "size": 4874, "upload_time": "2018-07-16T19:36:15", "url": "https://files.pythonhosted.org/packages/3d/36/f3bd577bd581b1f1137aa388a06fec6343829bde308c7ff5bf410f4b40de/python_chatfuel_class-2.1.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "aa05d13e8441fdc5470901baf32e9c64", "sha256": "e19678ae7d1cbac333e4ec8f7bd2664a5863168d2193b8fe744b8f5f23a33c81" }, "downloads": -1, "filename": "python_chatfuel_class-2.1.3.tar.gz", "has_sig": false, "md5_digest": "aa05d13e8441fdc5470901baf32e9c64", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*", "size": 4848, "upload_time": "2018-07-16T19:36:18", "url": "https://files.pythonhosted.org/packages/37/41/630970fc26adb50c9f1220de106e0321f64536d30c62a4002cdbe2ae81c0/python_chatfuel_class-2.1.3.tar.gz" } ] }