|
11 | 11 | },
|
12 | 12 | {
|
13 | 13 | "cell_type": "code",
|
14 |
| - "execution_count": 1, |
| 14 | + "execution_count": null, |
15 | 15 | "metadata": {},
|
16 |
| - "outputs": [ |
17 |
| - { |
18 |
| - "name": "stdout", |
19 |
| - "output_type": "stream", |
20 |
| - "text": [ |
21 |
| - "IPython autoawait is `on`, and set to use `asyncio`\n" |
22 |
| - ] |
23 |
| - } |
24 |
| - ], |
| 16 | + "outputs": [], |
25 | 17 | "source": [
|
26 | 18 | "%autoawait\n",
|
27 | 19 | "import time\n",
|
|
30 | 22 | },
|
31 | 23 | {
|
32 | 24 | "cell_type": "code",
|
33 |
| - "execution_count": 2, |
| 25 | + "execution_count": null, |
34 | 26 | "metadata": {},
|
35 | 27 | "outputs": [],
|
36 | 28 | "source": [
|
|
47 | 39 | "\n",
|
48 | 40 | "\n",
|
49 | 41 | "# Based on the aca-py agent you wish to control\n",
|
50 |
| - "agent_controller = AriesAgentController(webhook_host=WEBHOOK_HOST, webhook_port=WEBHOOK_PORT,\n", |
51 |
| - " webhook_base=WEBHOOK_BASE, admin_url=ADMIN_URL, api_key=API_KEY)" |
| 42 | + "agent_controller = AriesAgentController(admin_url=ADMIN_URL, api_key=API_KEY)" |
| 43 | + ] |
| 44 | + }, |
| 45 | + { |
| 46 | + "cell_type": "code", |
| 47 | + "execution_count": null, |
| 48 | + "metadata": {}, |
| 49 | + "outputs": [], |
| 50 | + "source": [ |
| 51 | + "agent_controller.init_webhook_server(webhook_host=WEBHOOK_HOST,\n", |
| 52 | + " webhook_port=WEBHOOK_PORT,\n", |
| 53 | + " webhook_base=WEBHOOK_BASE)" |
52 | 54 | ]
|
53 | 55 | },
|
54 | 56 | {
|
|
62 | 64 | },
|
63 | 65 | {
|
64 | 66 | "cell_type": "code",
|
65 |
| - "execution_count": 3, |
| 67 | + "execution_count": null, |
66 | 68 | "metadata": {},
|
67 | 69 | "outputs": [],
|
68 | 70 | "source": [
|
|
84 | 86 | },
|
85 | 87 | {
|
86 | 88 | "cell_type": "code",
|
87 |
| - "execution_count": 4, |
| 89 | + "execution_count": null, |
88 | 90 | "metadata": {},
|
89 | 91 | "outputs": [],
|
90 | 92 | "source": [
|
|
112 | 114 | },
|
113 | 115 | {
|
114 | 116 | "cell_type": "code",
|
115 |
| - "execution_count": 5, |
| 117 | + "execution_count": null, |
116 | 118 | "metadata": {},
|
117 |
| - "outputs": [ |
118 |
| - { |
119 |
| - "name": "stdout", |
120 |
| - "output_type": "stream", |
121 |
| - "text": [ |
122 |
| - "Results : [{'rfc23_state': 'completed', 'their_role': 'inviter', 'request_id': '5d457ff6-28c5-429d-b7cd-e3ab3b0dc829', 'invitation_key': 'D6x1TzfFP76ihR9zRZFdUgL4mvcE2F8JKCroQJyno1SE', 'created_at': '2021-03-29 15:20:13.311490Z', 'their_did': 'Rn6qN2oFfgPyRKoYP2JuTe', 'their_label': 'Bob', 'invitation_mode': 'once', 'my_did': 'MrasHcPmBT3H8VVYiaR7eA', 'connection_id': 'd61e6495-1b0a-41de-b9e6-db799e6e8bdf', 'routing_state': 'none', 'updated_at': '2021-03-29 15:20:33.593695Z', 'state': 'active', 'accept': 'manual'}]\n", |
123 |
| - "Connection : {'rfc23_state': 'completed', 'their_role': 'inviter', 'request_id': '5d457ff6-28c5-429d-b7cd-e3ab3b0dc829', 'invitation_key': 'D6x1TzfFP76ihR9zRZFdUgL4mvcE2F8JKCroQJyno1SE', 'created_at': '2021-03-29 15:20:13.311490Z', 'their_did': 'Rn6qN2oFfgPyRKoYP2JuTe', 'their_label': 'Bob', 'invitation_mode': 'once', 'my_did': 'MrasHcPmBT3H8VVYiaR7eA', 'connection_id': 'd61e6495-1b0a-41de-b9e6-db799e6e8bdf', 'routing_state': 'none', 'updated_at': '2021-03-29 15:20:33.593695Z', 'state': 'active', 'accept': 'manual'}\n", |
124 |
| - "Active Connection ID : d61e6495-1b0a-41de-b9e6-db799e6e8bdf\n" |
125 |
| - ] |
126 |
| - } |
127 |
| - ], |
| 119 | + "outputs": [], |
128 | 120 | "source": [
|
129 | 121 | "response = await agent_controller.connections.get_connections()\n",
|
130 | 122 | "results = response['results']\n",
|
|
144 | 136 | },
|
145 | 137 | {
|
146 | 138 | "cell_type": "code",
|
147 |
| - "execution_count": 6, |
| 139 | + "execution_count": null, |
148 | 140 | "metadata": {},
|
149 |
| - "outputs": [ |
150 |
| - { |
151 |
| - "name": "stdout", |
152 |
| - "output_type": "stream", |
153 |
| - "text": [ |
154 |
| - "d61e6495-1b0a-41de-b9e6-db799e6e8bdf\n", |
155 |
| - "WEBHOOK RECIEVED - basicmessages\n", |
156 |
| - "WEBHOOK RECIEVED - basicmessages\n", |
157 |
| - "HANDLE WEBHOOK - basicmessages\n", |
158 |
| - "Handle message {'connection_id': 'd61e6495-1b0a-41de-b9e6-db799e6e8bdf', 'message_id': 'ee83bb20-c7ff-4961-9be2-a123eeff927c', 'content': 'Hello from Bob', 'state': 'received'} d61e6495-1b0a-41de-b9e6-db799e6e8bdf\n", |
159 |
| - "Second Handler {'connection_id': 'd61e6495-1b0a-41de-b9e6-db799e6e8bdf', 'message_id': 'ee83bb20-c7ff-4961-9be2-a123eeff927c', 'content': 'Hello from Bob', 'state': 'received'} d61e6495-1b0a-41de-b9e6-db799e6e8bdf\n", |
160 |
| - "PUBSUB SENT - basicmessages\n", |
161 |
| - "HANDLE WEBHOOK - basicmessages\n", |
162 |
| - "Handle message {'connection_id': 'd61e6495-1b0a-41de-b9e6-db799e6e8bdf', 'message_id': 'ee83bb20-c7ff-4961-9be2-a123eeff927c', 'content': 'Hello from Bob', 'state': 'received'} d61e6495-1b0a-41de-b9e6-db799e6e8bdf\n", |
163 |
| - "Second Handler {'connection_id': 'd61e6495-1b0a-41de-b9e6-db799e6e8bdf', 'message_id': 'ee83bb20-c7ff-4961-9be2-a123eeff927c', 'content': 'Hello from Bob', 'state': 'received'} d61e6495-1b0a-41de-b9e6-db799e6e8bdf\n", |
164 |
| - "PUBSUB SENT - basicmessages\n" |
165 |
| - ] |
166 |
| - } |
167 |
| - ], |
| 141 | + "outputs": [], |
168 | 142 | "source": [
|
169 | 143 | "print(connection[\"connection_id\"])\n",
|
170 | 144 | "id = connection[\"connection_id\"]"
|
171 | 145 | ]
|
172 | 146 | },
|
173 | 147 | {
|
174 | 148 | "cell_type": "code",
|
175 |
| - "execution_count": 7, |
| 149 | + "execution_count": null, |
176 | 150 | "metadata": {},
|
177 |
| - "outputs": [ |
178 |
| - { |
179 |
| - "data": { |
180 |
| - "text/plain": [ |
181 |
| - "{'thread_id': '5568ca7b-4922-4360-8794-dcb3910403dc'}" |
182 |
| - ] |
183 |
| - }, |
184 |
| - "execution_count": 7, |
185 |
| - "metadata": {}, |
186 |
| - "output_type": "execute_result" |
187 |
| - } |
188 |
| - ], |
| 151 | + "outputs": [], |
189 | 152 | "source": [
|
190 | 153 | "await agent_controller.messaging.trust_ping(id, \"hello, world!\")"
|
191 | 154 | ]
|
|
203 | 166 | },
|
204 | 167 | {
|
205 | 168 | "cell_type": "code",
|
206 |
| - "execution_count": 12, |
| 169 | + "execution_count": null, |
207 | 170 | "metadata": {},
|
208 |
| - "outputs": [ |
209 |
| - { |
210 |
| - "name": "stdout", |
211 |
| - "output_type": "stream", |
212 |
| - "text": [ |
213 |
| - "BASIC MESSAGE - Alice -> Bob\n", |
214 |
| - "{}\n", |
215 |
| - "Handle message {'connection_id': '4f66d7ac-2771-49c7-bf5c-0b84a228cb54', 'message_id': '5e8795cf-5311-4166-ad5f-259f22c40d93', 'content': 'This is a response from Bob', 'state': 'received'} 4f66d7ac-2771-49c7-bf5c-0b84a228cb54\n", |
216 |
| - "Handle message {'connection_id': '4f66d7ac-2771-49c7-bf5c-0b84a228cb54', 'message_id': '5e8795cf-5311-4166-ad5f-259f22c40d93', 'content': 'This is a response from Bob', 'state': 'received'} 4f66d7ac-2771-49c7-bf5c-0b84a228cb54\n", |
217 |
| - "Handle message {'connection_id': '4f66d7ac-2771-49c7-bf5c-0b84a228cb54', 'message_id': '93ddc727-6b92-4acd-8e1b-eaea87ec1091', 'content': 'This is a response from Bob', 'state': 'received'} 4f66d7ac-2771-49c7-bf5c-0b84a228cb54\n", |
218 |
| - "Handle message {'connection_id': '4f66d7ac-2771-49c7-bf5c-0b84a228cb54', 'message_id': '93ddc727-6b92-4acd-8e1b-eaea87ec1091', 'content': 'This is a response from Bob', 'state': 'received'} 4f66d7ac-2771-49c7-bf5c-0b84a228cb54\n" |
219 |
| - ] |
220 |
| - } |
221 |
| - ], |
| 171 | + "outputs": [], |
222 | 172 | "source": [
|
223 | 173 | "basic_message = \"hello from Alice\"\n",
|
224 | 174 | "response = await agent_controller.messaging.send_message(connection_id, basic_message)\n",
|
|
269 | 219 | "name": "python",
|
270 | 220 | "nbconvert_exporter": "python",
|
271 | 221 | "pygments_lexer": "ipython3",
|
272 |
| - "version": "3.7.6" |
| 222 | + "version": "3.8.5" |
273 | 223 | }
|
274 | 224 | },
|
275 | 225 | "nbformat": 4,
|
|
0 commit comments