{ "info": { "author": "Harshad Ranganathan", "author_email": "rharshad93@gmail.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "[![Build Status](https://travis-ci.com/HarshadRanganathan/ms-teams.svg?branch=master)](https://travis-ci.com/HarshadRanganathan/ms-teams)\n\n# ms-teams\n\nHelper library to construct microsoft teams connector card messages.\n\nThis library supports building:\n1. [Legacy Message Card](https://docs.microsoft.com/en-us/outlook/actionable-messages/message-card-reference)\n2. [Adaptive Message Card](https://docs.microsoft.com/en-us/outlook/actionable-messages/adaptive-card) (Not yet supported in teams connector)\n\n## Usage\n\n### Legacy Message Card\n\nLet's build below message card using ms-teams library.\n\n![Message Card](https://github.com/HarshadRanganathan/ms-teams/blob/master/images/Message_Card.png?raw=true)\n\n```python\n# imports\nfrom msteams.messagecard.fact import Fact\nfrom msteams.messagecard.section import Section\nfrom msteams.messagecard.card import MessageCard\n\n# Create Activity Section\nactivity_section = Section()\\\n\t.activity_group(activity_image='https://www.shareicon.net/data/32x32/2016/07/16/634601_python_512x512.png',\n\t activity_title='Description',\n\t activity_text='Helper library to construct microsoft teams connector card messages')\\\n\t.build()\n\n# Add activity section to the message card\nmessage_card = MessageCard().title('ms-teams')\\\n .summary('Helper library to construct microsoft teams connector card messages')\\\n .theme_color('FF0000')\\\n .section(activity_section)\n\n# Create facts\npkg_info = Section()\\\n .fact(Fact('URL', 'https://github.com/HarshadRanganathan/ms-teams').build())\\\n .fact(Fact('AUTHOR', 'Harshad Ranganathan').build())\\\n .build()\n\n# Add facts to the message card and construct the message\npayload = message_card.section(pkg_info).build()\n```\n\n\n### Adaptive Card\n\nYou can use [Card Playground](https://messagecardplayground.azurewebsites.net/) to craft your adaptive cards and build your messages.\n\nRefer [Adaptive Card Schema](https://docs.microsoft.com/en-us/adaptive-cards/authoring-cards/card-schema) for authoring your cards. \n\nLet's build below adaptive card using ms-teams library.\n\n![Adaptive Card](https://github.com/HarshadRanganathan/ms-teams/blob/master/images/Adaptive_Card.png?raw=true)\n\n```python\n# imports\nfrom msteams.adaptivecard.elements.image import Image\nfrom msteams.adaptivecard.elements.text_block import TextBlock\nfrom msteams.adaptivecard.containers.column import Column\nfrom msteams.adaptivecard.containers.column_set import ColumnSet\nfrom msteams.adaptivecard.containers.container import Container\nfrom msteams.adaptivecard.containers.fact_set import FactSet\nfrom msteams.adaptivecard.containers.fact import Fact\nfrom msteams.adaptivecard.card import AdaptiveCard\n\n# Create Title using TextBlock (Displays text, allowing control over font sizes, weight, and color.)\ntitle = TextBlock('ms-teams').separator(True).size('Medium').weight('Bolder').build()\n\n# Create Activity Block (Image, Title, Subtitle)\nactivity_image = Image('https://www.shareicon.net/data/32x32/2016/07/16/634601_python_512x512.png').style('Person').size('small').build()\nactivity_title = TextBlock('Description').weight('Bolder').wrap(True).build()\nactivity_text = TextBlock('Helper library to construct microsoft teams connector card messages').spacing('None').wrap(True).build()\n\n# Create ColumnSet which allows elements to sit side-by-side\nactivity_image_col = Column('auto').element(activity_image).build()\nactivity_text_col = Column('stretch').element(activity_title).element(activity_text).build()\nactivity_grp = ColumnSet().column(activity_image_col).column(activity_text_col).build()\n\n# Create Container to group items together\nheader = Container().element(title).element(activity_grp).build()\n\n# Add the container to the adaptive card\nadaptive_card = AdaptiveCard().container(header)\n\n# Add series of facts to the Container\npkg_info = Container()\n\nbasic = FactSet(separator=True)\\\n .fact(Fact('URL', 'https://github.com/HarshadRanganathan/ms-teams').build()) \\\n .fact(Fact('AUTHOR', 'Harshad Ranganathan').build()) \\\n .fact(Fact('LICENSE', 'MIT').build()) \\\n .build()\n\nkeywords = FactSet(separator=True) \\\n .fact(Fact('KEYWORDS', 'Microsoft Teams').build()) \\\n .build()\n\nclassifiers = FactSet(separator=True) \\\n .fact(Fact('CLASSIFIERS', 'Programming Language :: Python :: 3.7\\n\\n'\n 'License :: OSI Approved :: MIT License\\n\\n'\n 'Operating System :: OS Independent').build()) \\\n .build()\n\npkg_info.element(basic)\npkg_info.element(keywords)\npkg_info.element(classifiers)\n\n# Build the container\nbody = pkg_info.build()\n\n# Add facts container to the adaptive card and generate the payload message\npayload = adaptive_card.container(body).build()\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/HarshadRanganathan/ms-teams", "keywords": "Microsoft Teams", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "ms-teams", "package_url": "https://pypi.org/project/ms-teams/", "platform": "", "project_url": "https://pypi.org/project/ms-teams/", "project_urls": { "Homepage": "https://github.com/HarshadRanganathan/ms-teams" }, "release_url": "https://pypi.org/project/ms-teams/0.1.0/", "requires_dist": [ "jsonpickle" ], "requires_python": ">=3.7", "summary": "Helper library to construct microsoft teams connector cards", "version": "0.1.0" }, "last_serial": 5197192, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "64fea3ec96a346ed88189f8f0ce71644", "sha256": "577920673fd79c374cc8db02e2c6fb9c1fefdf2c2f6d64b233eccbb3e24dd130" }, "downloads": -1, "filename": "ms_teams-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "64fea3ec96a346ed88189f8f0ce71644", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7", "size": 11007, "upload_time": "2019-04-27T17:04:57", "url": "https://files.pythonhosted.org/packages/7c/5c/cf03fb041e7be0e58363e3eba5d68cce26c8621b9e9c738fa3f1ea0ac348/ms_teams-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "42377c728ab9f75902fc947f44766498", "sha256": "c9b8c75041e7eb998634f1111bf285512736e771e513cde8566d715379c478ec" }, "downloads": -1, "filename": "ms-teams-0.1.0.tar.gz", "has_sig": false, "md5_digest": "42377c728ab9f75902fc947f44766498", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7", "size": 6038, "upload_time": "2019-04-27T17:05:15", "url": "https://files.pythonhosted.org/packages/98/03/fce6161bb7af9acecc482d7cce7a264bd4244cf6803598902e7eb9f45d59/ms-teams-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "64fea3ec96a346ed88189f8f0ce71644", "sha256": "577920673fd79c374cc8db02e2c6fb9c1fefdf2c2f6d64b233eccbb3e24dd130" }, "downloads": -1, "filename": "ms_teams-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "64fea3ec96a346ed88189f8f0ce71644", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7", "size": 11007, "upload_time": "2019-04-27T17:04:57", "url": "https://files.pythonhosted.org/packages/7c/5c/cf03fb041e7be0e58363e3eba5d68cce26c8621b9e9c738fa3f1ea0ac348/ms_teams-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "42377c728ab9f75902fc947f44766498", "sha256": "c9b8c75041e7eb998634f1111bf285512736e771e513cde8566d715379c478ec" }, "downloads": -1, "filename": "ms-teams-0.1.0.tar.gz", "has_sig": false, "md5_digest": "42377c728ab9f75902fc947f44766498", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7", "size": 6038, "upload_time": "2019-04-27T17:05:15", "url": "https://files.pythonhosted.org/packages/98/03/fce6161bb7af9acecc482d7cce7a264bd4244cf6803598902e7eb9f45d59/ms-teams-0.1.0.tar.gz" } ] }