Skip to content

Commit 7754314

Browse files
committed
added adaptive card processing sample
1 parent b0e552c commit 7754314

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

docs/user/cards.rst

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,36 @@ The message we send with this code then looks like this in our Webex space
4040
client:
4141

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

0 commit comments

Comments
 (0)