fancy-microsoft-outlook 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fancy_microsoft_outlook-0.1.0/.gitignore +24 -0
- fancy_microsoft_outlook-0.1.0/CHANGELOG.md +25 -0
- fancy_microsoft_outlook-0.1.0/LICENSE +21 -0
- fancy_microsoft_outlook-0.1.0/PKG-INFO +185 -0
- fancy_microsoft_outlook-0.1.0/README.md +163 -0
- fancy_microsoft_outlook-0.1.0/art/fancified.svg +26 -0
- fancy_microsoft_outlook-0.1.0/pyproject.toml +87 -0
- fancy_microsoft_outlook-0.1.0/src/fancy_microsoft_outlook/__init__.py +47 -0
- fancy_microsoft_outlook-0.1.0/src/fancy_microsoft_outlook/_fake.py +170 -0
- fancy_microsoft_outlook-0.1.0/src/fancy_microsoft_outlook/_runtime.py +465 -0
- fancy_microsoft_outlook-0.1.0/src/fancy_microsoft_outlook/actions/__init__.py +22 -0
- fancy_microsoft_outlook-0.1.0/src/fancy_microsoft_outlook/actions/event_get.py +79 -0
- fancy_microsoft_outlook-0.1.0/src/fancy_microsoft_outlook/actions/event_list.py +82 -0
- fancy_microsoft_outlook-0.1.0/src/fancy_microsoft_outlook/actions/subscription_create.py +111 -0
- fancy_microsoft_outlook-0.1.0/src/fancy_microsoft_outlook/actions/subscription_delete.py +84 -0
- fancy_microsoft_outlook-0.1.0/src/fancy_microsoft_outlook/actions/subscription_renew.py +93 -0
- fancy_microsoft_outlook-0.1.0/src/fancy_microsoft_outlook/faker.py +259 -0
- fancy_microsoft_outlook-0.1.0/src/fancy_microsoft_outlook/py.typed +0 -0
- fancy_microsoft_outlook-0.1.0/src/fancy_microsoft_outlook/service.py +76 -0
- fancy_microsoft_outlook-0.1.0/src/fancy_microsoft_outlook/triggers/__init__.py +14 -0
- fancy_microsoft_outlook-0.1.0/src/fancy_microsoft_outlook/triggers/calendar_changed.py +123 -0
- fancy_microsoft_outlook-0.1.0/tests/test_faker.py +207 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
node_modules/
|
|
2
|
+
dist/
|
|
3
|
+
vendor/
|
|
4
|
+
.venv/
|
|
5
|
+
__pycache__/
|
|
6
|
+
*.egg-info/
|
|
7
|
+
.pytest_cache/
|
|
8
|
+
.ruff_cache/
|
|
9
|
+
.mypy_cache/
|
|
10
|
+
|
|
11
|
+
# Lockfiles are NOT source of a generated repo.
|
|
12
|
+
#
|
|
13
|
+
# The generator cannot emit one -- a lockfile is the result of a network
|
|
14
|
+
# resolve -- and "a provider repo must be generated and re-generatable" is the
|
|
15
|
+
# constraint the whole estate rests on. At a few hundred repos, a committed
|
|
16
|
+
# lockfile each is a few hundred files nothing can regenerate and a few hundred
|
|
17
|
+
# Dependabot surfaces.
|
|
18
|
+
#
|
|
19
|
+
# The trade is real and worth stating: CI resolves fresh on every run, so an
|
|
20
|
+
# upstream release inside the declared range can break a build with no change
|
|
21
|
+
# here. That is early warning rather than a surprise at publish time, and the
|
|
22
|
+
# ranges are deliberately narrow (>=X <2.0, never a caret on a 0.x).
|
|
23
|
+
composer.lock
|
|
24
|
+
package-lock.json
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@particle-academy/microsoft-outlook-ui`,
|
|
4
|
+
`@particle-academy/microsoft-outlook-js`, `particle-academy/microsoft-outlook-php`
|
|
5
|
+
and `fancy-microsoft-outlook`.
|
|
6
|
+
|
|
7
|
+
The four packages share one version, because they are generated from one
|
|
8
|
+
`provider/` definition and a version that meant something different in each
|
|
9
|
+
would be a version nobody could reason about.
|
|
10
|
+
|
|
11
|
+
## [0.1.0] — 2026-09-15
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- **First release.** The calendar half of Outlook, on Microsoft Graph v1.0:
|
|
16
|
+
actions `event_get`, `event_list`, `subscription_create`,
|
|
17
|
+
`subscription_renew` and `subscription_delete`; the `calendar_changed`
|
|
18
|
+
trigger with `delivery: "subscription"` — a Graph subscription capped at
|
|
19
|
+
10080 minutes, renewed by `subscription_renew` 3600 seconds before expiry,
|
|
20
|
+
its lease read from `expirationDateTime`. Deliveries are batches, verified
|
|
21
|
+
by the `clientState` Graph echoes in every item, and the endpoint answers
|
|
22
|
+
Graph's `validationToken` challenge before anything is delivered.
|
|
23
|
+
- Requires `fancy-connector-core` ≥ 0.8.0 in js and php — the release that
|
|
24
|
+
carries `LeaseDeclaration`, the shared-token verification scheme and the
|
|
25
|
+
challenge handshake.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Particle Academy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: fancy-microsoft-outlook
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Microsoft Outlook for Python — the service descriptor, its faker, its webhook verification, and one function per operation. Plain HTTP; no vendor SDK.
|
|
5
|
+
Project-URL: Homepage, https://github.com/Fancy-Friends/microsoft-outlook
|
|
6
|
+
Project-URL: Issues, https://github.com/Fancy-Friends/microsoft-outlook/issues
|
|
7
|
+
Project-URL: Source, https://github.com/Fancy-Friends/microsoft-outlook
|
|
8
|
+
Author: Particle Academy
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: api,calendar,connector,fancy-flow,microsoft_outlook,particle-academy
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
19
|
+
Classifier: Typing :: Typed
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# Microsoft Outlook
|
|
24
|
+
|
|
25
|
+
[](https://particle.academy)
|
|
26
|
+
|
|
27
|
+
Microsoft Outlook for [fancy-flow][flow] — as **four imported, versioned packages**, one
|
|
28
|
+
per runtime. Not vendored source: a copy cannot be upgraded, and third-party APIs
|
|
29
|
+
change.
|
|
30
|
+
|
|
31
|
+
[flow]: https://github.com/Particle-Academy/fancy-flow
|
|
32
|
+
|
|
33
|
+
| Runtime | Package | Install |
|
|
34
|
+
|---|---|---|
|
|
35
|
+
| Authoring surface (every host) | `@particle-academy/microsoft-outlook-ui` | `npm install @particle-academy/microsoft-outlook-ui` |
|
|
36
|
+
| Node | `@particle-academy/microsoft-outlook-js` | `npm install @particle-academy/microsoft-outlook-js` |
|
|
37
|
+
| PHP 8.4+ | `particle-academy/microsoft-outlook-php` | `composer require particle-academy/microsoft-outlook-php` |
|
|
38
|
+
| Python 3.11+ | `fancy-microsoft-outlook` | `pip install fancy-microsoft-outlook` |
|
|
39
|
+
|
|
40
|
+
The `ui` package is the editor surface and is React on every host — a PHP or
|
|
41
|
+
Python project installs it *and* its own runtime package, and never the `js` one.
|
|
42
|
+
|
|
43
|
+
## What it costs you
|
|
44
|
+
|
|
45
|
+
One dependency: `@particle-academy/fancy-connector-core` (or
|
|
46
|
+
`particle-academy/fancy-connector-core` on Composer), which the `js` and `php`
|
|
47
|
+
packages pull in themselves. The Python package has **zero** runtime
|
|
48
|
+
dependencies.
|
|
49
|
+
|
|
50
|
+
**No Microsoft Outlook SDK.** Plain HTTP, deliberately: a vendor SDK is third-party code
|
|
51
|
+
subject to the kit's full approval bar, and one per provider is hundreds of
|
|
52
|
+
dependencies nobody is tracking.
|
|
53
|
+
|
|
54
|
+
## Setting it up
|
|
55
|
+
|
|
56
|
+
Everything below is generated from `provider/manifest.json`, so it cannot disagree with what the packages do.
|
|
57
|
+
|
|
58
|
+
### Credentials
|
|
59
|
+
|
|
60
|
+
A Microsoft Outlook connection holds 5 values.
|
|
61
|
+
|
|
62
|
+
**Two kinds of value, and mixing them up matters.** A `provider` credential is ONE value for the whole installation — an OAuth app's client secret serves every connected account. An `account` credential is one per connected account. A host that stores the second where it stores the first lets one account's credentials reach another's.
|
|
63
|
+
|
|
64
|
+
| Field | Scope | Secret | Where it comes from |
|
|
65
|
+
|---|---|---|---|
|
|
66
|
+
| **Application (client) ID** | per installation | not secret | From the Microsoft Entra admin center -> App registrations. ONE value for the whole installation, not per connected account. |
|
|
67
|
+
| **Client secret** | per installation | **secret** | A client secret of the same app registration. One value for the whole installation; Entra expires them, so record the expiry. |
|
|
68
|
+
| **Access token** | per connected account | **secret** | Per connected Microsoft account, and it expires after about ONE HOUR. The host refreshes it with the refresh token. |
|
|
69
|
+
| **Refresh token** | per connected account | **secret** | Per connected Microsoft account; issued only when the consent request includes offline_access. Every refresh answers with a NEW one -- persist it -- while the old one keeps working until it expires. |
|
|
70
|
+
| **Client state** | per connected account | **secret** | A secret the host chooses per connected account and sends as `clientState` on every subscription. Graph echoes it inside every notification, and that echo is the ONLY thing that authenticates a delivery -- Graph does not sign them. At most 128 characters. |
|
|
71
|
+
|
|
72
|
+
### Authorising
|
|
73
|
+
|
|
74
|
+
Microsoft Outlook uses OAuth2 (authorization_code). The package DECLARES the exchange; the HOST performs it — a consent screen needs a browser, a redirect URI and somewhere to persist the result, and all three belong to the host.
|
|
75
|
+
|
|
76
|
+
- **Authorize URL** — https://login.microsoftonline.com/common/oauth2/v2.0/authorize
|
|
77
|
+
- **Token URL** — https://login.microsoftonline.com/common/oauth2/v2.0/token
|
|
78
|
+
- **Scopes** — `Calendars.Read`, `offline_access`
|
|
79
|
+
- **Access token lifetime** — 3600 seconds (1 hours). A host that never refreshes works all afternoon and is broken by morning.
|
|
80
|
+
|
|
81
|
+
The refresh tokens do **not** rotate: the same one is reusable, so a refresh may safely be retried and may run concurrently. Stated rather than assumed, because the opposite — a provider that spends the token and revokes the grant on a replay — looks identical until it happens.
|
|
82
|
+
|
|
83
|
+
### The estate
|
|
84
|
+
|
|
85
|
+
Microsoft Outlook has a test estate on the same host, reached with credentials from a SEPARATE test account you register. Selecting sandbox mode uses those credentials.
|
|
86
|
+
|
|
87
|
+
> Microsoft's test estate is a Microsoft 365 Developer Program sandbox: a separate E5 tenant with its own users, its own calendars and its own OAuth consent, on the SAME host. Eligibility is limited -- Visual Studio Professional or Enterprise subscribers, ISV Success / Microsoft AI Cloud Partner Program members, or Premier/Unified Support customers -- and the tenant expires after 90 days of no development activity. Without one, every call reaches a real mailbox.
|
|
88
|
+
|
|
89
|
+
## What it can do
|
|
90
|
+
|
|
91
|
+
### Actions
|
|
92
|
+
|
|
93
|
+
#### `event_get` — Outlook calendar event
|
|
94
|
+
|
|
95
|
+
Read one event from the connected account's Outlook calendar.
|
|
96
|
+
|
|
97
|
+
`GET /v1.0/me/events/{id}` · reads only — safe to replay
|
|
98
|
+
|
|
99
|
+
| Input | Required | What it is |
|
|
100
|
+
|---|---|---|
|
|
101
|
+
| `id` | yes | The event's id, as published by a notification's resourceData.id or by event_list. |
|
|
102
|
+
|
|
103
|
+
#### `event_list` — Outlook calendar events
|
|
104
|
+
|
|
105
|
+
List events from the connected account's Outlook calendar.
|
|
106
|
+
|
|
107
|
+
`GET /v1.0/me/events` · reads only — safe to replay
|
|
108
|
+
|
|
109
|
+
| Input | Required | What it is |
|
|
110
|
+
|---|---|---|
|
|
111
|
+
| `top` | no | Events per page. An @odata.nextLink in the response means there are more. |
|
|
112
|
+
| `filter` | no | An OData $filter. Leave blank for everything. |
|
|
113
|
+
| `orderby` | no | An OData $orderby. Leave blank for Graph's default order. |
|
|
114
|
+
| `select` | no | An OData $select, comma separated. Leave blank for Graph's default set. |
|
|
115
|
+
|
|
116
|
+
#### `subscription_create` — Outlook subscription
|
|
117
|
+
|
|
118
|
+
Subscribe to change notifications on the connected account's calendar events. The host's subscription machinery calls this; it is not a node most workflows need.
|
|
119
|
+
|
|
120
|
+
`POST /v1.0/subscriptions` · **unsafe to replay** — a retried durable run does it TWICE
|
|
121
|
+
|
|
122
|
+
| Input | Required | What it is |
|
|
123
|
+
|---|---|---|
|
|
124
|
+
| `changeType` | no | Which changes raise a notification. Graph accepts a comma-separated combination. |
|
|
125
|
+
| `resource` | yes | The Graph resource to watch, without the base URL. `me/events` is the connected account's calendar events. |
|
|
126
|
+
| `notificationUrl` | yes | The HTTPS URL the host mounts for this trigger. Graph validates it with a validationToken challenge before creating the subscription, then POSTs change notifications to it. |
|
|
127
|
+
| `lifecycleNotificationUrl` | no | Where Graph sends `reauthorizationRequired`, `subscriptionRemoved` and `missed` events. May be the notification URL itself. Optional, but without it a subscription Graph removed is one nobody hears about. |
|
|
128
|
+
| `expirationDateTime` | yes | When the subscription expires, as an ISO 8601 instant in UTC. The host computes now + the trigger's lifetime; Graph caps an event subscription at 10080 minutes (under seven days) and raises anything under 45 minutes to 45. |
|
|
129
|
+
| `clientState` | yes | The connection's clientState. The host fills this from the connection -- never type a value here. Graph echoes it inside every notification, and that echo is how a delivery is verified. At most 128 characters. |
|
|
130
|
+
|
|
131
|
+
#### `subscription_delete` — Outlook subscription removal
|
|
132
|
+
|
|
133
|
+
Delete a change-notification subscription. The host's subscription machinery calls this when a trigger is removed.
|
|
134
|
+
|
|
135
|
+
`DELETE /v1.0/subscriptions/{id}` · idempotent — safe to replay
|
|
136
|
+
|
|
137
|
+
| Input | Required | What it is |
|
|
138
|
+
|---|---|---|
|
|
139
|
+
| `id` | yes | The id subscription_create answered with. |
|
|
140
|
+
|
|
141
|
+
#### `subscription_renew` — Outlook subscription renewal
|
|
142
|
+
|
|
143
|
+
Extend a change-notification subscription before it expires. The host's subscription machinery calls this when the lease is due.
|
|
144
|
+
|
|
145
|
+
`PATCH /v1.0/subscriptions/{id}` · idempotent — safe to replay
|
|
146
|
+
|
|
147
|
+
| Input | Required | What it is |
|
|
148
|
+
|---|---|---|
|
|
149
|
+
| `id` | yes | The id subscription_create answered with. |
|
|
150
|
+
| `expirationDateTime` | yes | The new expiry, as an ISO 8601 instant in UTC. The host computes now + the trigger's lifetime, capped at 10080 minutes for events. |
|
|
151
|
+
|
|
152
|
+
### Triggers
|
|
153
|
+
|
|
154
|
+
#### `calendar_changed` — Outlook calendar change
|
|
155
|
+
|
|
156
|
+
Start a run when an event is created, updated or deleted on a subscribed Outlook calendar.
|
|
157
|
+
|
|
158
|
+
A SUBSCRIPTION: Microsoft Outlook delivers to your endpoint only while a subscription it issued is alive, at most 168 hours at a time. Its expiry is read from the `subscription_create` response (`expirationDateTime`); 3600 seconds before it, the host renews it (`subscription_renew`). A lease that lapses is re-listed AND re-subscribed, because notifications during the gap are gone. Every delivery: the token Microsoft Outlook echoes back is compared with the connection's `clientState` before anything runs. Microsoft Outlook sends a `validationToken` challenge before it delivers anything, and the endpoint must echo it as plain text.
|
|
159
|
+
|
|
160
|
+
**You have to set this up with the provider first:**
|
|
161
|
+
|
|
162
|
+
The host calls subscription_create with its own URL for this trigger, an expiry of now plus this lifetime, and the connection's clientState, and must answer Graph's validationToken challenge on that URL as plain text within 10 seconds or the subscription is refused. It stores the returned id and expirationDateTime. 3600 seconds before expiry it calls subscription_renew; a 404 there means the subscription is gone and it re-lists (event_list) and creates again, because notifications during the gap are gone. Every notification is a batch: the host compares each item's clientState with the connection's clientState, answers 202, and then processes the items. A `missed` lifecycle event means re-list; `reauthorizationRequired` means renew; `subscriptionRemoved` means create again and re-list.
|
|
163
|
+
|
|
164
|
+
## Run it before you have credentials
|
|
165
|
+
|
|
166
|
+
Every operation ships a **faker**, whether or not Microsoft Outlook has a sandbox. Set a
|
|
167
|
+
node's mode to `fake` and it returns the shape Microsoft Outlook actually publishes — the
|
|
168
|
+
same field names, deterministically — so you can wire the downstream nodes before
|
|
169
|
+
touching an account, a key, or a network.
|
|
170
|
+
|
|
171
|
+
## This repository is generated
|
|
172
|
+
|
|
173
|
+
`provider/` is the source. Everything under `packages/` is emitted from it and
|
|
174
|
+
**must not be hand-edited** — CI regenerates and diffs on every push, and the
|
|
175
|
+
next protocol sync destroys anything it finds. See [`AGENTS.md`](AGENTS.md).
|
|
176
|
+
|
|
177
|
+
## Two namespaces, which do not match on purpose
|
|
178
|
+
|
|
179
|
+
The repo is `github.com/Fancy-Friends/microsoft-outlook`; the packages publish under
|
|
180
|
+
`particle-academy`. Nothing derives one from the other — the names come from
|
|
181
|
+
weaver's `friends.json` and nowhere else.
|
|
182
|
+
|
|
183
|
+
## Licence
|
|
184
|
+
|
|
185
|
+
MIT.
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# Microsoft Outlook
|
|
2
|
+
|
|
3
|
+
[](https://particle.academy)
|
|
4
|
+
|
|
5
|
+
Microsoft Outlook for [fancy-flow][flow] — as **four imported, versioned packages**, one
|
|
6
|
+
per runtime. Not vendored source: a copy cannot be upgraded, and third-party APIs
|
|
7
|
+
change.
|
|
8
|
+
|
|
9
|
+
[flow]: https://github.com/Particle-Academy/fancy-flow
|
|
10
|
+
|
|
11
|
+
| Runtime | Package | Install |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| Authoring surface (every host) | `@particle-academy/microsoft-outlook-ui` | `npm install @particle-academy/microsoft-outlook-ui` |
|
|
14
|
+
| Node | `@particle-academy/microsoft-outlook-js` | `npm install @particle-academy/microsoft-outlook-js` |
|
|
15
|
+
| PHP 8.4+ | `particle-academy/microsoft-outlook-php` | `composer require particle-academy/microsoft-outlook-php` |
|
|
16
|
+
| Python 3.11+ | `fancy-microsoft-outlook` | `pip install fancy-microsoft-outlook` |
|
|
17
|
+
|
|
18
|
+
The `ui` package is the editor surface and is React on every host — a PHP or
|
|
19
|
+
Python project installs it *and* its own runtime package, and never the `js` one.
|
|
20
|
+
|
|
21
|
+
## What it costs you
|
|
22
|
+
|
|
23
|
+
One dependency: `@particle-academy/fancy-connector-core` (or
|
|
24
|
+
`particle-academy/fancy-connector-core` on Composer), which the `js` and `php`
|
|
25
|
+
packages pull in themselves. The Python package has **zero** runtime
|
|
26
|
+
dependencies.
|
|
27
|
+
|
|
28
|
+
**No Microsoft Outlook SDK.** Plain HTTP, deliberately: a vendor SDK is third-party code
|
|
29
|
+
subject to the kit's full approval bar, and one per provider is hundreds of
|
|
30
|
+
dependencies nobody is tracking.
|
|
31
|
+
|
|
32
|
+
## Setting it up
|
|
33
|
+
|
|
34
|
+
Everything below is generated from `provider/manifest.json`, so it cannot disagree with what the packages do.
|
|
35
|
+
|
|
36
|
+
### Credentials
|
|
37
|
+
|
|
38
|
+
A Microsoft Outlook connection holds 5 values.
|
|
39
|
+
|
|
40
|
+
**Two kinds of value, and mixing them up matters.** A `provider` credential is ONE value for the whole installation — an OAuth app's client secret serves every connected account. An `account` credential is one per connected account. A host that stores the second where it stores the first lets one account's credentials reach another's.
|
|
41
|
+
|
|
42
|
+
| Field | Scope | Secret | Where it comes from |
|
|
43
|
+
|---|---|---|---|
|
|
44
|
+
| **Application (client) ID** | per installation | not secret | From the Microsoft Entra admin center -> App registrations. ONE value for the whole installation, not per connected account. |
|
|
45
|
+
| **Client secret** | per installation | **secret** | A client secret of the same app registration. One value for the whole installation; Entra expires them, so record the expiry. |
|
|
46
|
+
| **Access token** | per connected account | **secret** | Per connected Microsoft account, and it expires after about ONE HOUR. The host refreshes it with the refresh token. |
|
|
47
|
+
| **Refresh token** | per connected account | **secret** | Per connected Microsoft account; issued only when the consent request includes offline_access. Every refresh answers with a NEW one -- persist it -- while the old one keeps working until it expires. |
|
|
48
|
+
| **Client state** | per connected account | **secret** | A secret the host chooses per connected account and sends as `clientState` on every subscription. Graph echoes it inside every notification, and that echo is the ONLY thing that authenticates a delivery -- Graph does not sign them. At most 128 characters. |
|
|
49
|
+
|
|
50
|
+
### Authorising
|
|
51
|
+
|
|
52
|
+
Microsoft Outlook uses OAuth2 (authorization_code). The package DECLARES the exchange; the HOST performs it — a consent screen needs a browser, a redirect URI and somewhere to persist the result, and all three belong to the host.
|
|
53
|
+
|
|
54
|
+
- **Authorize URL** — https://login.microsoftonline.com/common/oauth2/v2.0/authorize
|
|
55
|
+
- **Token URL** — https://login.microsoftonline.com/common/oauth2/v2.0/token
|
|
56
|
+
- **Scopes** — `Calendars.Read`, `offline_access`
|
|
57
|
+
- **Access token lifetime** — 3600 seconds (1 hours). A host that never refreshes works all afternoon and is broken by morning.
|
|
58
|
+
|
|
59
|
+
The refresh tokens do **not** rotate: the same one is reusable, so a refresh may safely be retried and may run concurrently. Stated rather than assumed, because the opposite — a provider that spends the token and revokes the grant on a replay — looks identical until it happens.
|
|
60
|
+
|
|
61
|
+
### The estate
|
|
62
|
+
|
|
63
|
+
Microsoft Outlook has a test estate on the same host, reached with credentials from a SEPARATE test account you register. Selecting sandbox mode uses those credentials.
|
|
64
|
+
|
|
65
|
+
> Microsoft's test estate is a Microsoft 365 Developer Program sandbox: a separate E5 tenant with its own users, its own calendars and its own OAuth consent, on the SAME host. Eligibility is limited -- Visual Studio Professional or Enterprise subscribers, ISV Success / Microsoft AI Cloud Partner Program members, or Premier/Unified Support customers -- and the tenant expires after 90 days of no development activity. Without one, every call reaches a real mailbox.
|
|
66
|
+
|
|
67
|
+
## What it can do
|
|
68
|
+
|
|
69
|
+
### Actions
|
|
70
|
+
|
|
71
|
+
#### `event_get` — Outlook calendar event
|
|
72
|
+
|
|
73
|
+
Read one event from the connected account's Outlook calendar.
|
|
74
|
+
|
|
75
|
+
`GET /v1.0/me/events/{id}` · reads only — safe to replay
|
|
76
|
+
|
|
77
|
+
| Input | Required | What it is |
|
|
78
|
+
|---|---|---|
|
|
79
|
+
| `id` | yes | The event's id, as published by a notification's resourceData.id or by event_list. |
|
|
80
|
+
|
|
81
|
+
#### `event_list` — Outlook calendar events
|
|
82
|
+
|
|
83
|
+
List events from the connected account's Outlook calendar.
|
|
84
|
+
|
|
85
|
+
`GET /v1.0/me/events` · reads only — safe to replay
|
|
86
|
+
|
|
87
|
+
| Input | Required | What it is |
|
|
88
|
+
|---|---|---|
|
|
89
|
+
| `top` | no | Events per page. An @odata.nextLink in the response means there are more. |
|
|
90
|
+
| `filter` | no | An OData $filter. Leave blank for everything. |
|
|
91
|
+
| `orderby` | no | An OData $orderby. Leave blank for Graph's default order. |
|
|
92
|
+
| `select` | no | An OData $select, comma separated. Leave blank for Graph's default set. |
|
|
93
|
+
|
|
94
|
+
#### `subscription_create` — Outlook subscription
|
|
95
|
+
|
|
96
|
+
Subscribe to change notifications on the connected account's calendar events. The host's subscription machinery calls this; it is not a node most workflows need.
|
|
97
|
+
|
|
98
|
+
`POST /v1.0/subscriptions` · **unsafe to replay** — a retried durable run does it TWICE
|
|
99
|
+
|
|
100
|
+
| Input | Required | What it is |
|
|
101
|
+
|---|---|---|
|
|
102
|
+
| `changeType` | no | Which changes raise a notification. Graph accepts a comma-separated combination. |
|
|
103
|
+
| `resource` | yes | The Graph resource to watch, without the base URL. `me/events` is the connected account's calendar events. |
|
|
104
|
+
| `notificationUrl` | yes | The HTTPS URL the host mounts for this trigger. Graph validates it with a validationToken challenge before creating the subscription, then POSTs change notifications to it. |
|
|
105
|
+
| `lifecycleNotificationUrl` | no | Where Graph sends `reauthorizationRequired`, `subscriptionRemoved` and `missed` events. May be the notification URL itself. Optional, but without it a subscription Graph removed is one nobody hears about. |
|
|
106
|
+
| `expirationDateTime` | yes | When the subscription expires, as an ISO 8601 instant in UTC. The host computes now + the trigger's lifetime; Graph caps an event subscription at 10080 minutes (under seven days) and raises anything under 45 minutes to 45. |
|
|
107
|
+
| `clientState` | yes | The connection's clientState. The host fills this from the connection -- never type a value here. Graph echoes it inside every notification, and that echo is how a delivery is verified. At most 128 characters. |
|
|
108
|
+
|
|
109
|
+
#### `subscription_delete` — Outlook subscription removal
|
|
110
|
+
|
|
111
|
+
Delete a change-notification subscription. The host's subscription machinery calls this when a trigger is removed.
|
|
112
|
+
|
|
113
|
+
`DELETE /v1.0/subscriptions/{id}` · idempotent — safe to replay
|
|
114
|
+
|
|
115
|
+
| Input | Required | What it is |
|
|
116
|
+
|---|---|---|
|
|
117
|
+
| `id` | yes | The id subscription_create answered with. |
|
|
118
|
+
|
|
119
|
+
#### `subscription_renew` — Outlook subscription renewal
|
|
120
|
+
|
|
121
|
+
Extend a change-notification subscription before it expires. The host's subscription machinery calls this when the lease is due.
|
|
122
|
+
|
|
123
|
+
`PATCH /v1.0/subscriptions/{id}` · idempotent — safe to replay
|
|
124
|
+
|
|
125
|
+
| Input | Required | What it is |
|
|
126
|
+
|---|---|---|
|
|
127
|
+
| `id` | yes | The id subscription_create answered with. |
|
|
128
|
+
| `expirationDateTime` | yes | The new expiry, as an ISO 8601 instant in UTC. The host computes now + the trigger's lifetime, capped at 10080 minutes for events. |
|
|
129
|
+
|
|
130
|
+
### Triggers
|
|
131
|
+
|
|
132
|
+
#### `calendar_changed` — Outlook calendar change
|
|
133
|
+
|
|
134
|
+
Start a run when an event is created, updated or deleted on a subscribed Outlook calendar.
|
|
135
|
+
|
|
136
|
+
A SUBSCRIPTION: Microsoft Outlook delivers to your endpoint only while a subscription it issued is alive, at most 168 hours at a time. Its expiry is read from the `subscription_create` response (`expirationDateTime`); 3600 seconds before it, the host renews it (`subscription_renew`). A lease that lapses is re-listed AND re-subscribed, because notifications during the gap are gone. Every delivery: the token Microsoft Outlook echoes back is compared with the connection's `clientState` before anything runs. Microsoft Outlook sends a `validationToken` challenge before it delivers anything, and the endpoint must echo it as plain text.
|
|
137
|
+
|
|
138
|
+
**You have to set this up with the provider first:**
|
|
139
|
+
|
|
140
|
+
The host calls subscription_create with its own URL for this trigger, an expiry of now plus this lifetime, and the connection's clientState, and must answer Graph's validationToken challenge on that URL as plain text within 10 seconds or the subscription is refused. It stores the returned id and expirationDateTime. 3600 seconds before expiry it calls subscription_renew; a 404 there means the subscription is gone and it re-lists (event_list) and creates again, because notifications during the gap are gone. Every notification is a batch: the host compares each item's clientState with the connection's clientState, answers 202, and then processes the items. A `missed` lifecycle event means re-list; `reauthorizationRequired` means renew; `subscriptionRemoved` means create again and re-list.
|
|
141
|
+
|
|
142
|
+
## Run it before you have credentials
|
|
143
|
+
|
|
144
|
+
Every operation ships a **faker**, whether or not Microsoft Outlook has a sandbox. Set a
|
|
145
|
+
node's mode to `fake` and it returns the shape Microsoft Outlook actually publishes — the
|
|
146
|
+
same field names, deterministically — so you can wire the downstream nodes before
|
|
147
|
+
touching an account, a key, or a network.
|
|
148
|
+
|
|
149
|
+
## This repository is generated
|
|
150
|
+
|
|
151
|
+
`provider/` is the source. Everything under `packages/` is emitted from it and
|
|
152
|
+
**must not be hand-edited** — CI regenerates and diffs on every push, and the
|
|
153
|
+
next protocol sync destroys anything it finds. See [`AGENTS.md`](AGENTS.md).
|
|
154
|
+
|
|
155
|
+
## Two namespaces, which do not match on purpose
|
|
156
|
+
|
|
157
|
+
The repo is `github.com/Fancy-Friends/microsoft-outlook`; the packages publish under
|
|
158
|
+
`particle-academy`. Nothing derives one from the other — the names come from
|
|
159
|
+
weaver's `friends.json` and nowhere else.
|
|
160
|
+
|
|
161
|
+
## Licence
|
|
162
|
+
|
|
163
|
+
MIT.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="28" role="img" aria-label="Fancified — built with Fancy UI">
|
|
2
|
+
<title>Fancified · built with Fancy UI</title>
|
|
3
|
+
<defs>
|
|
4
|
+
<linearGradient id="fcdBg" x1="0" y1="0" x2="1" y2="1">
|
|
5
|
+
<stop offset="0" stop-color="#6d28d9"/>
|
|
6
|
+
<stop offset=".5" stop-color="#9333ea"/>
|
|
7
|
+
<stop offset="1" stop-color="#d946ef"/>
|
|
8
|
+
</linearGradient>
|
|
9
|
+
<linearGradient id="fcdGloss" x1="0" y1="0" x2="0" y2="1">
|
|
10
|
+
<stop offset="0" stop-color="#ffffff" stop-opacity=".30"/>
|
|
11
|
+
<stop offset=".55" stop-color="#ffffff" stop-opacity="0"/>
|
|
12
|
+
</linearGradient>
|
|
13
|
+
<clipPath id="fcdClip"><rect width="128" height="28" rx="7"/></clipPath>
|
|
14
|
+
</defs>
|
|
15
|
+
<g clip-path="url(#fcdClip)">
|
|
16
|
+
<rect width="128" height="28" fill="url(#fcdBg)"/>
|
|
17
|
+
<rect width="34" height="28" fill="#3b0764" fill-opacity=".5"/>
|
|
18
|
+
<rect width="128" height="13" fill="url(#fcdGloss)"/>
|
|
19
|
+
<g fill="#fff">
|
|
20
|
+
<path transform="translate(17 14)" d="M0 -7 C.6 -2.2 2.2 -.6 7 0 C2.2 .6 .6 2.2 0 7 C-.6 2.2 -2.2 .6 -7 0 C-2.2 -.6 -.6 -2.2 0 -7 Z"/>
|
|
21
|
+
<path transform="translate(25.5 7.5) scale(.34)" fill-opacity=".85" d="M0 -7 C.6 -2.2 2.2 -.6 7 0 C2.2 .6 .6 2.2 0 7 C-.6 2.2 -2.2 .6 -7 0 C-2.2 -.6 -.6 -2.2 0 -7 Z"/>
|
|
22
|
+
</g>
|
|
23
|
+
<text x="81" y="18.5" fill="#ffffff" text-anchor="middle" font-family="'Segoe UI',Verdana,'DejaVu Sans',sans-serif" font-size="12" font-weight="700" letter-spacing=".3">Fancified</text>
|
|
24
|
+
</g>
|
|
25
|
+
<rect x=".5" y=".5" width="127" height="27" rx="6.5" fill="none" stroke="#ffffff" stroke-opacity=".22"/>
|
|
26
|
+
</svg>
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.27"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "fancy-microsoft-outlook"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Microsoft Outlook for Python — the service descriptor, its faker, its webhook verification, and one function per operation. Plain HTTP; no vendor SDK."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
# 3.11 matches fancy-flow-py's floor: 3.10 reaches end of life on 2026-10-31,
|
|
11
|
+
# and a floor that dies before the package's second release is not a floor.
|
|
12
|
+
requires-python = ">=3.11"
|
|
13
|
+
license = "MIT"
|
|
14
|
+
license-files = ["LICENSE"]
|
|
15
|
+
authors = [{ name = "Particle Academy" }]
|
|
16
|
+
keywords = ["microsoft_outlook", "calendar", "connector", "api", "fancy-flow", "particle-academy"]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 3 - Alpha",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.11",
|
|
22
|
+
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"Programming Language :: Python :: 3.13",
|
|
24
|
+
"Topic :: Software Development :: Libraries",
|
|
25
|
+
"Typing :: Typed",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
# ZERO runtime dependencies, and that is a design constraint rather than an
|
|
29
|
+
# accident. There is no Python twin of fancy-connector-core to depend on, and a
|
|
30
|
+
# vendor SDK is third-party code subject to the kit's full approval bar — one
|
|
31
|
+
# SDK per provider is hundreds of dependencies nobody is tracking. The HTTP is
|
|
32
|
+
# stdlib `urllib`; the HMAC is stdlib `hmac`.
|
|
33
|
+
dependencies = []
|
|
34
|
+
|
|
35
|
+
[project.urls]
|
|
36
|
+
Homepage = "https://github.com/Fancy-Friends/microsoft-outlook"
|
|
37
|
+
Issues = "https://github.com/Fancy-Friends/microsoft-outlook/issues"
|
|
38
|
+
Source = "https://github.com/Fancy-Friends/microsoft-outlook"
|
|
39
|
+
|
|
40
|
+
[dependency-groups]
|
|
41
|
+
# Not optional. A package with no way to run its tests reports green by doing
|
|
42
|
+
# nothing, which is the one defect that hides itself.
|
|
43
|
+
test = ["pytest>=8.0"]
|
|
44
|
+
lint = ["ruff>=0.16"]
|
|
45
|
+
typecheck = ["mypy>=1.11"]
|
|
46
|
+
dev = [{ include-group = "test" }, { include-group = "lint" }, { include-group = "typecheck" }]
|
|
47
|
+
|
|
48
|
+
[tool.hatch.build.targets.wheel]
|
|
49
|
+
packages = ["src/fancy_microsoft_outlook"]
|
|
50
|
+
|
|
51
|
+
[tool.hatch.build.targets.sdist]
|
|
52
|
+
include = ["/src", "/tests", "/art", "/README.md", "/CHANGELOG.md", "/LICENSE"]
|
|
53
|
+
|
|
54
|
+
[tool.pytest.ini_options]
|
|
55
|
+
testpaths = ["tests"]
|
|
56
|
+
# importlib mode pairs with src-layout: the working tree is never on sys.path,
|
|
57
|
+
# so the tests exercise the INSTALLED package. Under the default mode a missing
|
|
58
|
+
# py.typed or an unshipped file passes locally and breaks for every user.
|
|
59
|
+
addopts = "--import-mode=importlib -ra"
|
|
60
|
+
|
|
61
|
+
[tool.ruff]
|
|
62
|
+
line-length = 100
|
|
63
|
+
src = ["src", "tests"]
|
|
64
|
+
target-version = "py311"
|
|
65
|
+
|
|
66
|
+
[tool.ruff.lint]
|
|
67
|
+
# `S` — flake8-bandit — is ON, and it is the one addition worth arguing for: this
|
|
68
|
+
# package handles a credential, builds an HMAC, and opens a URL. Security lint
|
|
69
|
+
# belongs on exactly this code.
|
|
70
|
+
#
|
|
71
|
+
# It also makes the two `# noqa: S310` in _runtime.py MEANINGFUL. Without `S`
|
|
72
|
+
# selected, ruff reports them as unused directives (RUF100) and the obvious fix
|
|
73
|
+
# is to delete them — which quietly removes a security annotation because a
|
|
74
|
+
# linter was not looking for it.
|
|
75
|
+
select = ["E", "F", "I", "UP", "B", "SIM", "RUF", "N", "C4", "PT", "S"]
|
|
76
|
+
|
|
77
|
+
[tool.ruff.lint.per-file-ignores]
|
|
78
|
+
# pytest's whole idiom is bare `assert`. S101 would fail every test file.
|
|
79
|
+
"tests/*" = ["S101"]
|
|
80
|
+
|
|
81
|
+
[tool.mypy]
|
|
82
|
+
python_version = "3.11"
|
|
83
|
+
packages = ["fancy_microsoft_outlook"]
|
|
84
|
+
mypy_path = "src"
|
|
85
|
+
strict = true
|
|
86
|
+
disallow_any_expr = false
|
|
87
|
+
disallow_any_explicit = false
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# GENERATED FILE — do not edit.
|
|
2
|
+
#
|
|
3
|
+
# Emitted from provider/manifest.json by weaver's generator.
|
|
4
|
+
# A hand-edit here is destroyed by the next protocol sync, which is worse than
|
|
5
|
+
# being rejected, because it works until it silently does not. Fix
|
|
6
|
+
# provider/manifest.json (or weaver's template/) and regenerate:
|
|
7
|
+
#
|
|
8
|
+
# npm run provider -- microsoft_outlook
|
|
9
|
+
|
|
10
|
+
"""Microsoft Outlook for Python.
|
|
11
|
+
|
|
12
|
+
The service descriptor, its faker, its delivery contract, and one function
|
|
13
|
+
per operation — plain HTTP on the stdlib, no vendor SDK and no runtime
|
|
14
|
+
dependency.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
from ._fake import FakeValues
|
|
20
|
+
from .actions.event_get import event_get
|
|
21
|
+
from .actions.event_list import event_list
|
|
22
|
+
from .actions.subscription_create import subscription_create
|
|
23
|
+
from .actions.subscription_delete import subscription_delete
|
|
24
|
+
from .actions.subscription_renew import subscription_renew
|
|
25
|
+
from .faker import respond
|
|
26
|
+
from .service import BASE_URLS, CONNECTOR_API_VERSION, REQUIRES, SANDBOX, SERVICE, TITLE, descriptor
|
|
27
|
+
from .triggers import calendar_changed
|
|
28
|
+
|
|
29
|
+
__version__ = "0.1.0"
|
|
30
|
+
|
|
31
|
+
__all__ = [
|
|
32
|
+
"BASE_URLS",
|
|
33
|
+
"CONNECTOR_API_VERSION",
|
|
34
|
+
"REQUIRES",
|
|
35
|
+
"SANDBOX",
|
|
36
|
+
"SERVICE",
|
|
37
|
+
"TITLE",
|
|
38
|
+
"FakeValues",
|
|
39
|
+
"calendar_changed",
|
|
40
|
+
"descriptor",
|
|
41
|
+
"event_get",
|
|
42
|
+
"event_list",
|
|
43
|
+
"respond",
|
|
44
|
+
"subscription_create",
|
|
45
|
+
"subscription_delete",
|
|
46
|
+
"subscription_renew",
|
|
47
|
+
]
|