Skip to content

Commit cb6c3a1

Browse files
author
Joseph Zanini
authored
Merge branch 'master' into master
2 parents 365ff1b + 4f6e780 commit cb6c3a1

37 files changed

+3708
-290
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Local Files
22
local/
3-
3+
.vscode/
44

55
# Virtual Environments
66
.venv/

Pipfile.lock

Lines changed: 450 additions & 246 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.rst

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
=============
2-
webexteamssdk
2+
WebexPythonSDK
33
=============
44

5-
*Work with the Webex Teams APIs in native Python!*
5+
*Work with the Webex APIs in native Python!*
66

77
.. image:: https://img.shields.io/badge/license-MIT-blue.svg
88
:target: https://github.com/CiscoDevNet/webexteamssdk/blob/master/LICENSE
@@ -27,8 +27,8 @@ ideas there.
2727
------------------------------------------------------------------------------------------------------------------------
2828

2929

30-
**webexteamssdk** is a *community developed* Python library for working with the Webex Teams APIs. Our goal is to make
31-
working with Webex Teams in Python a *native* and *natural* experience!
30+
**WebexPythonSDK** is a *community developed* Python library for working with the Webex APIs. Our goal is to make
31+
working with Webex in Python a *native* and *natural* experience!
3232

3333
.. code-block:: Python
3434
@@ -57,27 +57,27 @@ working with Webex Teams in Python a *native* and *natural* experience!
5757
files=["https://www.webex.com/content/dam/wbx/us/images/dg-integ/teams_icon.png"])
5858
5959
60-
That's more than 6 Webex Teams API calls in less than 23 lines of code (with comments and whitespace), and likely more
61-
than that, since webexteamssdk handles pagination_ for you automatically!
60+
That's more than 6 Webex API calls in less than 23 lines of code (with comments and whitespace), and likely more
61+
than that, since WebexPythonSDK handles pagination_ for you automatically!
6262

63-
webexteamssdk makes your life better... `Learn how!`__
63+
WebexPythonSDK makes your life better... `Learn how!`__
6464

6565
__ Introduction_
6666

6767

6868
Features
6969
--------
7070

71-
webexteamssdk does all of this for you:
71+
WebexPythonSDK does all of this for you:
7272

73-
* Transparently sources your Webex Teams access token from your local environment
73+
* Transparently sources your Webex access token from your local environment
7474

7575
* Provides and uses default arguments and settings everywhere possible, so you don't have to think about things like API
7676
endpoint URLs, HTTP headers and JSON formats
7777

78-
* Represents all Webex Teams API interactions using native Python tools
78+
* Represents all Webex API interactions using native Python tools
7979

80-
* Authentication and Connection to the Webex Teams Cloud ==> **WebexTeamsAPI** "connection object"
80+
* Authentication and Connection to the Webex Cloud ==> **WebexTeamsAPI** "connection object"
8181

8282
* API Calls ==> Hierarchically organized methods underneath the **WebexTeamsAPI** 'Connection Object'
8383

@@ -139,10 +139,10 @@ published releases.
139139
Questions, Support & Discussion
140140
-------------------------------
141141

142-
webexteamssdk is a *community developed* and *community-supported* project. If you experience any issues using this
142+
WebexPythonSDK is a *community developed* and *community-supported* project. If you experience any issues using this
143143
package, please report them using the issues_ page.
144144

145-
Please join the `Python Webex Teams Devs`__ Webex Teams space to ask questions, join the discussion, and share your
145+
Please join the `Python Webex Teams Devs`__ Webex space to ask questions, join the discussion, and share your
146146
projects and creations.
147147

148148
__ Community_
@@ -151,15 +151,15 @@ __ Community_
151151
Contribution
152152
------------
153153

154-
webexteamssdk_ is a community development project. Feedback, thoughts, ideas, and code contributions are welcome!
154+
WebexPythonSDK is a community development project. Feedback, thoughts, ideas, and code contributions are welcome!
155155
Please see the `Contributing`_ guide for more information.
156156

157157

158158
History
159159
-------
160160

161-
The Webex Teams SDK (webexteamssdk) library started as Cisco Spark API (ciscosparkapi). We updated the library's name in
162-
alignment with Cisco's re-brand of Cisco Spark to Webex Teams. The Cisco Spark API library has been deprecated and is no
161+
The Webex Python SDK (webexteamssdk) library started as Cisco Spark API (ciscosparkapi). We updated the library's name in
162+
alignment with Cisco's re-brand of Cisco Spark to Webex. The Cisco Spark API library has been deprecated and is no
163163
longer supported; however, its open-source codebase is still available in the `ciscosparkapi`_ branch of this
164164
repository.
165165

@@ -172,7 +172,7 @@ developer.webex.com.
172172

173173
.. _Release Plan: https://github.com/CiscoDevNet/webexteamssdk/wiki/Release-Plans
174174
.. _Introduction: http://webexteamssdk.readthedocs.io/en/latest/user/intro.html
175-
.. _pagination: https://developer.webex.com/pagination.html
175+
.. _pagination: https://developer.webex.com/docs/basics#pagination
176176
.. _webexteamssdk.readthedocs.io: https://webexteamssdk.readthedocs.io
177177
.. _Quickstart: http://webexteamssdk.readthedocs.io/en/latest/user/quickstart.html
178178
.. _examples: https://github.com/CiscoDevNet/webexteamssdk/tree/master/examples

docs/user/cards.rst

Lines changed: 45 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,26 @@
44
Cards and Buttons
55
=================
66

7-
Webex Teams supports `AdaptiveCards <https://www.adaptivecards.io/>`_ to allow
7+
Webex supports `AdaptiveCards <https://www.adaptivecards.io/>`_ to allow
88
new levels of interactivity for bots and integrations. You can read more about
99
how cards and buttons work `in the official guide <https://developer.webex.com/docs/api/guides/cards>`_.
1010

11-
In this guide I want to cover the abstraction build into the webexteamssdk that
11+
In this guide I want to cover the abstraction built into the webexteamssdk that
1212
lets you author adaptive cards in pure python without having to touch the
13-
underlying json of a adaptive card.
13+
underlying JSON of an adaptive card.
14+
15+
Sending a card
16+
==============
1417

1518
Lets dive into a simple example that sends a card to a room
1619

1720
.. code-block:: python
1821
1922
from webexteamssdk import WebexTeamsAPI
20-
from webexteamssdk.cards.card import AdaptiveCard
21-
from webexteamssdk.cards.inputs import Text, Number
22-
from webexteamssdk.cards.components import TextBlock
23-
from webexteamssdk.cards.actions import Submit
23+
from webexteamssdk.models.cards.card import AdaptiveCard
24+
from webexteamssdk.models.cards.inputs import Text, Number
25+
from webexteamssdk.models.cards.components import TextBlock
26+
from webexteamssdk.models.cards.actions import Submit
2427
2528
greeting = TextBlock("Hey hello there! I am a adaptive card")
2629
first_name = Text('first_name', placeholder="First Name")
@@ -33,7 +36,41 @@ Lets dive into a simple example that sends a card to a room
3336
api = WebexTeamsAPI()
3437
api.messages.create(text="fallback", roomId="...", attachments=[card])
3538
36-
The message we send with this code then looks like this in our Webex Teams
39+
The message we send with this code then looks like this in our Webex space
3740
client:
3841

3942
.. image:: ../images/cards_sample.png
43+
44+
45+
Processing a card action
46+
========================
47+
48+
49+
Adaptive card interactions are treated as "attachment actions". Once user interacts
50+
with your card and submits an action, your app will receive a webhook from Webex. You
51+
must :ref:`setup a webhook <webhooks>` in advance with ``resource = "attachmentActions"``
52+
and ``event = "created"``.
53+
54+
Webhook payload will contain a JSON:
55+
56+
.. code-block:: json
57+
58+
{
59+
"resource": "attachmentActions",
60+
"event": "created",
61+
"data": {
62+
"id": "XYXYXY",
63+
"type": "submit"
64+
}
65+
}
66+
67+
Extract attachment action ID from ``['data']['id']`` and
68+
use :ref:`attachment_actions.get() <attachment_actions>` to get full information
69+
about user action and any submitted data.
70+
71+
.. code-block:: python
72+
73+
action = api.attachment_actions.get(webhookJson['data']['id'])
74+
75+
first_name = action.inputs['first_name']
76+
age = action.inputs['age']

docs/user/quickstart.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ requesting user.
2626
To get your personal access token:
2727

2828
1. Login to `developer.webex.com`_
29-
2. Click on Docs or browse to the `Getting Started <https://developer.webex.com/getting-started.html>`_ page
29+
2. Click on Docs or browse to the `Getting Started <https://developer.webex.com/docs/getting-started>`_ page
3030
3. You will find your *personal access token* in the
31-
`Authentication <https://developer.webex.com/getting-started.html#authentication>`_ section
31+
`Authentication <https://developer.webex.com/docs/getting-started#accounts-and-authentication>`_ section
3232

3333
.. image:: ../images/personal_access_token.png
3434

@@ -60,7 +60,7 @@ It can be as simple as setting it in your CLI before running your script...
6060

6161
.. code-block:: bash
6262
63-
$ WEBEX_TEAMS_ACCESS_TOKEN=your_access_token_here
63+
$ export WEBEX_TEAMS_ACCESS_TOKEN=your_access_token_here
6464
$ python myscript.py
6565
6666
...or putting your credentials in a shell script that you ``source`` when your

0 commit comments

Comments
 (0)