-
Notifications
You must be signed in to change notification settings - Fork 152
Add Webex Teams Cards&Buttons as native python objects #93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Webex Teams Cards&Buttons as native python objects #93
Conversation
You can now send a card like this: ``` from webexteamssdk import WebexTeamsAPI from webexteamssdk.cards.card import AdaptiveCard from webexteamssdk.cards.components import TextBlock from webexteamssdk.cards.options import Colors block = TextBlock("Hey hello there! I am a adaptive card", color=Colors.GOOD) card = AdaptiveCard(body=[block]) api = WebexTeamsAPI() api.messages.create(text="fallback", roomId="...", cards=card) ```
@sQu4rks Thank you for the PR! I apologize for the delay in getting this merged. I am going to move the package to the |
No worries @cmlccie. I have since split this into its own package (see CiscoSE/pyadaptivecards). What do you think about adding that package as a dependency and import them in the init.py so that there is only one „adaptive Cards in python“ code base instead of two. |
Makes sense to me! I'll modify the webexteamssdk code to add this as an optional dependency. If you can incorporate the |
@sQu4rks in case you are interested... Here are the refactoring edits I made to the code. I agree it is better to have this functionality in a separate package that you can maintain without waiting on me. 🙂 Let me know when you have incorporated the Also, have you seen/used the pydantic library? I am increasing using this and FastAPI for projects. It could very easily be used to model the Adaptive Cards. I am considering using it to model the Webex Teams data models in a future release that will support Python v3 (only). I am also thinking of migrating the library to support both synchronous and asynchronous execution in a v3 release. |
This PR introduces Adaptive Cards as native python objects.
Example
will print the json required for this card