@mhome/messaging-protocol 0.14.0

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.
Files changed (61) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +71 -0
  3. package/fixtures/actor-link-claim-confirm.request.json +1 -0
  4. package/fixtures/actor-link-claim-confirm.response.json +1 -0
  5. package/fixtures/actor-link-claim-event.response.json +1 -0
  6. package/fixtures/actor-link-claim-status.request.json +1 -0
  7. package/fixtures/actor-link-claim-status.response.json +1 -0
  8. package/fixtures/actor-link-code-create.request.json +1 -0
  9. package/fixtures/actor-link-code-create.response.json +1 -0
  10. package/fixtures/actor-link-delete.request.json +1 -0
  11. package/fixtures/actor-link-delete.response.json +1 -0
  12. package/fixtures/actor-link-list.request.json +1 -0
  13. package/fixtures/actor-link-list.response.json +1 -0
  14. package/fixtures/invalid/mismatched-direction.json +5 -0
  15. package/fixtures/invalid/missing-required-extension.json +5 -0
  16. package/fixtures/invalid/unknown-request-field.json +5 -0
  17. package/fixtures/messaging-commands.conformance.json +20 -0
  18. package/fixtures/normalized-inbound.conformance.json +148 -0
  19. package/fixtures/normalized-inbound.shared-text.json +25 -0
  20. package/fixtures/provider-account-delete.request.json +9 -0
  21. package/fixtures/provider-account-delete.response.json +5 -0
  22. package/fixtures/provider-account-list.request.json +5 -0
  23. package/fixtures/provider-account-list.response.json +21 -0
  24. package/fixtures/provider-account-status.request.json +5 -0
  25. package/fixtures/provider-account-status.response.json +12 -0
  26. package/fixtures/provider-account-test.request.json +5 -0
  27. package/fixtures/provider-account-test.response.json +5 -0
  28. package/fixtures/provider-account-update.request.json +10 -0
  29. package/fixtures/provider-account-update.response.json +15 -0
  30. package/fixtures/provider-list.request.json +14 -0
  31. package/fixtures/provider-list.response.json +31 -0
  32. package/fixtures/route-delete.request.json +5 -0
  33. package/fixtures/route-delete.response.json +5 -0
  34. package/fixtures/route-list.request.json +5 -0
  35. package/fixtures/route-list.response.json +37 -0
  36. package/fixtures/route-update.request.json +12 -0
  37. package/fixtures/route-update.response.json +20 -0
  38. package/fixtures/setup-options.request.json +5 -0
  39. package/fixtures/setup-options.response.json +5 -0
  40. package/fixtures/setup-start.request.json +9 -0
  41. package/fixtures/setup-start.response.json +12 -0
  42. package/fixtures/setup-status.request.json +5 -0
  43. package/fixtures/setup-status.response.json +14 -0
  44. package/fixtures/shared-account-grant-create.request.json +5 -0
  45. package/fixtures/shared-account-grant-create.response.json +5 -0
  46. package/fixtures/shared-account-grant-delete.request.json +5 -0
  47. package/fixtures/shared-account-grant-delete.response.json +5 -0
  48. package/fixtures/shared-account-grant-list.request.json +5 -0
  49. package/fixtures/shared-account-grant-list.response.json +9 -0
  50. package/fixtures/surface-bind-code-create.request.json +1 -0
  51. package/fixtures/surface-bind-code-create.response.json +1 -0
  52. package/fixtures/surface-dismiss.request.json +1 -0
  53. package/fixtures/surface-dismiss.response.json +1 -0
  54. package/fixtures/surface-list.request.json +1 -0
  55. package/fixtures/surface-list.response.json +1 -0
  56. package/manifest/targets.v1.json +57 -0
  57. package/package.json +43 -0
  58. package/protocol.json +16 -0
  59. package/schema/messaging-commands.v1.schema.json +67 -0
  60. package/schema/messaging-frame.v3.schema.json +2534 -0
  61. package/schema/normalized-inbound.v4.schema.json +117 -0
package/LICENSE ADDED
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) MHOME AI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,71 @@
1
+ # mhome-messaging-api
2
+
3
+ Transport-neutral control and normalized data-plane contracts for messaging providers. The crate
4
+ owns typed Rust DTOs, target and capability inventories, strict JSON Schemas, and cross-language
5
+ conformance fixtures.
6
+
7
+ The common contract deliberately treats `data`, `providerData`, `options`, and `result` as provider
8
+ extension objects. Their contents are decoded and validated by the selected provider; all fields
9
+ outside those explicit extension points are closed and versioned here.
10
+
11
+ Conformance frames contain `target`, `direction`, and `body`. `direction` is part of the contract
12
+ artifact used by tests and generators; the surrounding MWS transport continues to carry request and
13
+ response correlation.
14
+
15
+ `control` models the MWS management API. `model` defines the canonical provider-independent address,
16
+ external actor, and inbound content semantics implemented independently by local Rust and cloud
17
+ Java runtimes. Neither module contains provider SDKs, transport callbacks, runtime lifecycle,
18
+ persistence, or Agent integration.
19
+
20
+ `commands` owns the small provider-independent chat command grammar. `/info`, `/help`, `/new`,
21
+ `/clear`, and `/switch N` have identical parsing semantics in every runtime. Scope choices are
22
+ ordered by their stable `scopeId`; providers remain free to render the resulting labels in their
23
+ native format. The published command corpus is the cross-language source of truth.
24
+
25
+ Every normalized message carries provider-neutral attention evidence: `addressed` means the
26
+ provider determined that the bot was explicitly targeted, `unaddressed` means it determined the
27
+ opposite, and `unknown` means the provider has no equivalent signal. Provider adapters extract this
28
+ evidence; common runtimes ignore only `unaddressed` messages on shared surfaces. Personal messages,
29
+ actions, and providers with unknown attention continue through the normal pipeline.
30
+
31
+ Interactive delivery is modeled as an `ActionSet` of user-facing labels and opaque tokens. An
32
+ inbound selection contains only `ActionSelected { token }`; approval decisions, dialog values, and
33
+ provider callback payloads stay in runtime-owned route stores. Setup claims and account lifecycle
34
+ are framework application ports rather than chat content, so they are intentionally not part of
35
+ this public normalized data plane.
36
+
37
+ Shared-conversation discovery, group binding challenges, and self-service actor links are common
38
+ management operations. Actor-link challenges explicitly target either a personal conversation or
39
+ one already-bound shared surface. A shared `/link` command records an immutable external-actor
40
+ candidate and requires confirmation by the authenticated challenge creator; a personal command may
41
+ complete immediately. Status is the recovery source of truth and the matching event target is only
42
+ a realtime hint. Challenge requests never carry a target user: each runtime derives the user from
43
+ its authenticated request context, authorizes scope ownership or membership, and stores only a
44
+ short-lived one-time code hash. Provider adapters remain responsible only for translating provider
45
+ events and sending provider-native replies.
46
+
47
+ A personal route belongs to one linked mHome user. Its `scopeId` is only the conversation's current
48
+ scope: authorization comes from live scope membership, and `/switch` may move it to any scope the
49
+ user still belongs to. Personal routes never depend on an account grant.
50
+
51
+ A shared account grant authorizes one provider account to serve one scope. It has no beneficiary
52
+ user and no default flag; `grantedByUserId` is audit metadata. Every shared route is fixed to one
53
+ scope, depends on the matching shared account grant, and cannot switch scopes. Current scope owners
54
+ manage grants and shared routes. Any linked actor who is still a member of the bound scope may answer
55
+ a shared interaction, while personal interactions remain restricted to the personal route owner.
56
+ Routes deliberately address the provider's base conversation only; lane identity remains on each
57
+ normalized address and canonical Conversation surface so topic-level threads do not multiply
58
+ authorization records.
59
+
60
+ Setup is provider-extensible but has a common lifecycle. A completed setup may return both the
61
+ created provider `accountId` and the initial personal `routeId`; providers that only configure an
62
+ account omit `routeId` until the first inbound conversation creates the route.
63
+
64
+ Actor links are provider-account-scoped identities. One exact external identity maps to at most one
65
+ mHome principal, while a principal may own any number of external identities across or within
66
+ provider accounts. Actor-link management therefore targets an account, never a conversation
67
+ surface; shared-surface binding remains a separate scope relationship.
68
+
69
+ `fixtures/normalized-inbound.conformance.json` is the executable cross-language corpus. Every
70
+ runtime implementation must accept every `valid` case and reject every `invalid` case; adding a
71
+ content variant or validation rule requires updating this corpus in the same change.
@@ -0,0 +1 @@
1
+ {"target":"/messaging/actor/link-claim/confirm","direction":"request","body":{"provider":"telegram","placement":"local","challengeId":"challenge_01"}}
@@ -0,0 +1 @@
1
+ {"target":"/messaging/actor/link-claim/confirm","direction":"response","body":{"claim":{"challengeId":"challenge_01","provider":"telegram","placement":"local","accountId":"bot_a","target":{"audience":"shared","surfaceId":"mg:telegram:bot_a:family"},"expiresAtMs":1720000300000,"lifecycle":{"state":"completed","candidate":{"actor":{"provider":"telegram","accountId":"bot_a","externalUserId":"tg_42","displayName":"Alice"},"address":{"provider":"telegram","accountId":"bot_a","conversationId":"family","audience":"shared"},"eventId":"update_99"},"linkId":"link_42"}}}}
@@ -0,0 +1 @@
1
+ {"target":"/messaging/actor/link-claim/event","direction":"response","body":{"claim":{"challengeId":"challenge_01","provider":"telegram","placement":"local","accountId":"bot_a","target":{"audience":"shared","surfaceId":"mg:telegram:bot_a:family"},"expiresAtMs":1720000300000,"lifecycle":{"state":"awaiting_confirmation","candidate":{"actor":{"provider":"telegram","accountId":"bot_a","externalUserId":"tg_42","displayName":"Alice"},"address":{"provider":"telegram","accountId":"bot_a","conversationId":"family","audience":"shared"},"eventId":"update_99"}}}}}
@@ -0,0 +1 @@
1
+ {"target":"/messaging/actor/link-claim/status","direction":"request","body":{"provider":"telegram","placement":"local","challengeId":"challenge_01"}}
@@ -0,0 +1 @@
1
+ {"target":"/messaging/actor/link-claim/status","direction":"response","body":{"claim":{"challengeId":"challenge_01","provider":"telegram","placement":"local","accountId":"bot_a","target":{"audience":"shared","surfaceId":"mg:telegram:bot_a:family"},"expiresAtMs":1720000300000,"lifecycle":{"state":"awaiting_confirmation","candidate":{"actor":{"provider":"telegram","accountId":"bot_a","externalUserId":"tg_42","displayName":"Alice"},"address":{"provider":"telegram","accountId":"bot_a","conversationId":"family","audience":"shared"},"eventId":"update_99"}}}}}
@@ -0,0 +1 @@
1
+ {"target":"/messaging/actor/link-code/create","direction":"request","body":{"provider":"telegram","placement":"local","accountId":"bot_a","target":{"audience":"shared","surfaceId":"mg:telegram:bot_a:family"}}}
@@ -0,0 +1 @@
1
+ {"target":"/messaging/actor/link-code/create","direction":"response","body":{"challenge":{"challengeId":"challenge_01","code":"P4V8N6","command":"/link P4V8N6","target":{"audience":"shared","surfaceId":"mg:telegram:bot_a:family"},"expiresAtMs":1720000300000}}}
@@ -0,0 +1 @@
1
+ {"target":"/messaging/actor/link/delete","direction":"request","body":{"provider":"telegram","placement":"local","linkId":"link_a"}}
@@ -0,0 +1 @@
1
+ {"target":"/messaging/actor/link/delete","direction":"response","body":{"success":true}}
@@ -0,0 +1 @@
1
+ {"target":"/messaging/actor/link/list","direction":"request","body":{"provider":"telegram","placement":"local","accountId":"bot_a"}}
@@ -0,0 +1 @@
1
+ {"target":"/messaging/actor/link/list","direction":"response","body":{"links":[{"linkId":"link_a","provider":"telegram","placement":"local","accountId":"bot_a","externalUserId":"user_42","displayName":"Alice","createdAtMs":1720000000000,"updatedAtMs":1720000000000}]}}
@@ -0,0 +1,5 @@
1
+ {
2
+ "target": "/messaging/shared-account-grant/create",
3
+ "direction": "response",
4
+ "body": { "provider": "telegram", "placement": "local", "accountId": "123456" }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "target": "/messaging/provider-account/test",
3
+ "direction": "request",
4
+ "body": { "provider": "telegram", "placement": "local" }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "target": "/messaging/provider-account/list",
3
+ "direction": "request",
4
+ "body": { "provider": "telegram", "placement": "local", "unexpected": true }
5
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "parseCases": [
4
+ { "name": "info", "input": "/info", "result": { "kind": "command", "command": "info" } },
5
+ { "name": "case-insensitive-help", "input": " /HELP ", "result": { "kind": "command", "command": "help" } },
6
+ { "name": "new-rotates", "input": "/new", "result": { "kind": "command", "command": "rotate" } },
7
+ { "name": "clear-rotates", "input": "/clear", "result": { "kind": "command", "command": "rotate" } },
8
+ { "name": "spaced-switch", "input": "/switch 3", "result": { "kind": "command", "command": "switch", "selection": 3 } },
9
+ { "name": "compact-switch", "input": "/SWITCH2", "result": { "kind": "command", "command": "switch", "selection": 2 } },
10
+ { "name": "missing-switch-selection", "input": "/switch", "result": { "kind": "invalid_switch" } },
11
+ { "name": "zero-switch-selection", "input": "/switch 0", "result": { "kind": "invalid_switch" } },
12
+ { "name": "negative-switch-selection", "input": "/switch -1", "result": { "kind": "invalid_switch" } },
13
+ { "name": "unknown-text", "input": "hello", "result": { "kind": "not_command" } },
14
+ { "name": "unknown-command", "input": "/usage", "result": { "kind": "not_command" } }
15
+ ],
16
+ "orderingCases": [
17
+ { "name": "stable-scope-id-order", "scopeIds": ["scope-z", "scope-a", "scope-m"], "expected": ["scope-a", "scope-m", "scope-z"] },
18
+ { "name": "lexical-order-is-case-sensitive", "scopeIds": ["scope-b", "Scope-a"], "expected": ["Scope-a", "scope-b"] }
19
+ ]
20
+ }
@@ -0,0 +1,148 @@
1
+ {
2
+ "valid": [
3
+ {
4
+ "name": "personal_text",
5
+ "value": {
6
+ "schemaVersion": 4,
7
+ "eventId": "event-personal-text",
8
+ "address": { "provider": "telegram", "accountId": "bot-1", "conversationId": "chat-1", "audience": "personal" },
9
+ "actor": { "provider": "telegram", "accountId": "bot-1", "externalUserId": "user-1", "displayName": "User One" },
10
+ "content": { "type": "message", "providerMessageId": "message-1", "attention": "unknown", "parts": [{ "type": "text", "text": "hello" }] },
11
+ "occurredAtMs": 1
12
+ }
13
+ },
14
+ {
15
+ "name": "shared_text_with_lane",
16
+ "value": {
17
+ "schemaVersion": 4,
18
+ "eventId": "event-shared-text",
19
+ "address": { "provider": "feishu", "accountId": "app-1", "conversationId": "group-1", "laneId": "thread-1", "audience": "shared" },
20
+ "actor": { "provider": "feishu", "accountId": "app-1", "externalUserId": "open-id-1" },
21
+ "content": { "type": "message", "attention": "addressed", "parts": [{ "type": "text", "text": "group hello" }] },
22
+ "conversationDisplayName": "Project room"
23
+ }
24
+ },
25
+ {
26
+ "name": "audio_with_transcript",
27
+ "value": {
28
+ "schemaVersion": 4,
29
+ "eventId": "event-audio",
30
+ "address": { "provider": "telegram", "accountId": "bot-1", "conversationId": "chat-1", "audience": "personal" },
31
+ "actor": { "provider": "telegram", "accountId": "bot-1", "externalUserId": "user-1" },
32
+ "content": {
33
+ "type": "message",
34
+ "providerMessageId": "message-2",
35
+ "attention": "unknown",
36
+ "parts": [{ "type": "media", "reference": { "handle": "file-1", "kind": "audio", "mimeType": "audio/ogg", "durationMs": 1200, "transcript": "hello" } }]
37
+ }
38
+ }
39
+ },
40
+ {
41
+ "name": "action_selected",
42
+ "value": {
43
+ "schemaVersion": 4,
44
+ "eventId": "event-action-selected",
45
+ "address": { "provider": "feishu", "accountId": "app-1", "conversationId": "chat-1", "audience": "personal" },
46
+ "actor": { "provider": "feishu", "accountId": "app-1", "externalUserId": "open-id-1" },
47
+ "content": { "type": "action_selected", "token": "route-1" }
48
+ }
49
+ }
50
+ ],
51
+ "invalid": [
52
+ {
53
+ "name": "provider_starts_with_digit",
54
+ "value": {
55
+ "schemaVersion": 4,
56
+ "eventId": "event",
57
+ "address": { "provider": "1telegram", "accountId": "bot", "conversationId": "chat", "audience": "personal" },
58
+ "actor": { "provider": "1telegram", "accountId": "bot", "externalUserId": "user" },
59
+ "content": { "type": "message", "attention": "unknown", "parts": [{ "type": "text", "text": "hello" }] }
60
+ }
61
+ },
62
+ {
63
+ "name": "negative_occurrence_time",
64
+ "value": {
65
+ "schemaVersion": 4,
66
+ "eventId": "event",
67
+ "address": { "provider": "telegram", "accountId": "bot", "conversationId": "chat", "audience": "personal" },
68
+ "actor": { "provider": "telegram", "accountId": "bot", "externalUserId": "user" },
69
+ "content": { "type": "message", "attention": "unknown", "parts": [{ "type": "text", "text": "hello" }] },
70
+ "occurredAtMs": -1
71
+ }
72
+ },
73
+ {
74
+ "name": "actor_account_mismatch",
75
+ "value": {
76
+ "schemaVersion": 4,
77
+ "eventId": "event",
78
+ "address": { "provider": "telegram", "accountId": "bot-a", "conversationId": "chat", "audience": "personal" },
79
+ "actor": { "provider": "telegram", "accountId": "bot-b", "externalUserId": "user" },
80
+ "content": { "type": "message", "attention": "unknown", "parts": [{ "type": "text", "text": "hello" }] }
81
+ }
82
+ },
83
+ {
84
+ "name": "empty_message",
85
+ "value": {
86
+ "schemaVersion": 4,
87
+ "eventId": "event",
88
+ "address": { "provider": "telegram", "accountId": "bot", "conversationId": "chat", "audience": "personal" },
89
+ "actor": { "provider": "telegram", "accountId": "bot", "externalUserId": "user" },
90
+ "content": { "type": "message", "attention": "unknown", "parts": [] }
91
+ }
92
+ },
93
+ {
94
+ "name": "incomplete_media_dimensions",
95
+ "value": {
96
+ "schemaVersion": 4,
97
+ "eventId": "event",
98
+ "address": { "provider": "telegram", "accountId": "bot", "conversationId": "chat", "audience": "personal" },
99
+ "actor": { "provider": "telegram", "accountId": "bot", "externalUserId": "user" },
100
+ "content": { "type": "message", "attention": "unknown", "parts": [{ "type": "media", "reference": { "handle": "file", "kind": "image", "widthPx": 100 } }] }
101
+ }
102
+ },
103
+ {
104
+ "name": "unknown_schema_version",
105
+ "value": {
106
+ "schemaVersion": 2,
107
+ "eventId": "event",
108
+ "address": { "provider": "telegram", "accountId": "bot", "conversationId": "chat", "audience": "personal" },
109
+ "actor": { "provider": "telegram", "accountId": "bot", "externalUserId": "user" },
110
+ "content": { "type": "message", "attention": "unknown", "parts": [{ "type": "text", "text": "hello" }] }
111
+ }
112
+ },
113
+ {
114
+ "name": "missing_message_attention",
115
+ "value": {
116
+ "schemaVersion": 4,
117
+ "eventId": "event",
118
+ "address": { "provider": "telegram", "accountId": "bot", "conversationId": "chat", "audience": "shared" },
119
+ "actor": { "provider": "telegram", "accountId": "bot", "externalUserId": "user" },
120
+ "content": { "type": "message", "parts": [{ "type": "text", "text": "hello" }] }
121
+ }
122
+ },
123
+ {
124
+ "name": "too_many_message_parts",
125
+ "value": {
126
+ "schemaVersion": 4,
127
+ "eventId": "event",
128
+ "address": { "provider": "telegram", "accountId": "bot", "conversationId": "chat", "audience": "personal" },
129
+ "actor": { "provider": "telegram", "accountId": "bot", "externalUserId": "user" },
130
+ "content": {
131
+ "type": "message",
132
+ "attention": "unknown",
133
+ "parts": [
134
+ { "type": "text", "text": "1" }, { "type": "text", "text": "2" },
135
+ { "type": "text", "text": "3" }, { "type": "text", "text": "4" },
136
+ { "type": "text", "text": "5" }, { "type": "text", "text": "6" },
137
+ { "type": "text", "text": "7" }, { "type": "text", "text": "8" },
138
+ { "type": "text", "text": "9" }, { "type": "text", "text": "10" },
139
+ { "type": "text", "text": "11" }, { "type": "text", "text": "12" },
140
+ { "type": "text", "text": "13" }, { "type": "text", "text": "14" },
141
+ { "type": "text", "text": "15" }, { "type": "text", "text": "16" },
142
+ { "type": "text", "text": "17" }
143
+ ]
144
+ }
145
+ }
146
+ }
147
+ ]
148
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "schemaVersion": 4,
3
+ "eventId": "telegram:update:41",
4
+ "address": {
5
+ "provider": "telegram",
6
+ "accountId": "bot-7",
7
+ "conversationId": "chat-42",
8
+ "laneId": "topic-3",
9
+ "audience": "shared"
10
+ },
11
+ "actor": {
12
+ "provider": "telegram",
13
+ "accountId": "bot-7",
14
+ "externalUserId": "user-9",
15
+ "displayName": "Yihan"
16
+ },
17
+ "content": {
18
+ "type": "message",
19
+ "providerMessageId": "message-5",
20
+ "attention": "addressed",
21
+ "parts": [{ "type": "text", "text": "hello" }]
22
+ },
23
+ "conversationDisplayName": "Project room",
24
+ "occurredAtMs": 1787760000000
25
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "target": "/messaging/provider-account/delete",
3
+ "direction": "request",
4
+ "body": {
5
+ "provider": "telegram",
6
+ "placement": "local",
7
+ "accountId": "123456"
8
+ }
9
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "target": "/messaging/provider-account/delete",
3
+ "direction": "response",
4
+ "body": { "success": true }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "target": "/messaging/provider-account/list",
3
+ "direction": "request",
4
+ "body": { "provider": "telegram", "placement": "local" }
5
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "target": "/messaging/provider-account/list",
3
+ "direction": "response",
4
+ "body": {
5
+ "accounts": [
6
+ {
7
+ "provider": "telegram",
8
+ "placement": "local",
9
+ "accountId": "123456",
10
+ "ownership": "user",
11
+ "displayName": "Home bot",
12
+ "enabled": true,
13
+ "status": "connected",
14
+ "providerData": {
15
+ "botUsername": "home_bot",
16
+ "transport": "long_polling"
17
+ }
18
+ }
19
+ ]
20
+ }
21
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "target": "/messaging/provider-account/status",
3
+ "direction": "request",
4
+ "body": { "provider": "telegram", "placement": "local" }
5
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "target": "/messaging/provider-account/status",
3
+ "direction": "response",
4
+ "body": {
5
+ "status": {
6
+ "provider": "telegram",
7
+ "placement": "local",
8
+ "enabled": true,
9
+ "providerData": { "connected": 1 }
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "target": "/messaging/provider-account/test",
3
+ "direction": "request",
4
+ "body": { "provider": "telegram", "placement": "local", "data": { "botToken": "secret" } }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "target": "/messaging/provider-account/test",
3
+ "direction": "response",
4
+ "body": { "result": { "reachable": true } }
5
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "target": "/messaging/provider-account/update",
3
+ "direction": "request",
4
+ "body": {
5
+ "provider": "telegram",
6
+ "placement": "local",
7
+ "accountId": "123456",
8
+ "data": { "enabled": true }
9
+ }
10
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "target": "/messaging/provider-account/update",
3
+ "direction": "response",
4
+ "body": {
5
+ "account": {
6
+ "provider": "telegram",
7
+ "placement": "local",
8
+ "accountId": "123456",
9
+ "ownership": "user",
10
+ "enabled": true,
11
+ "status": "connected",
12
+ "providerData": {}
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "target": "/messaging/provider/list",
3
+ "direction": "request",
4
+ "body": {
5
+ "placement": "cloud",
6
+ "frontendProviders": [
7
+ {
8
+ "provider": "telegram",
9
+ "deprecated": false,
10
+ "supportedPlacements": ["cloud", "local"]
11
+ }
12
+ ]
13
+ }
14
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "target": "/messaging/provider/list",
3
+ "direction": "response",
4
+ "body": {
5
+ "providers": [
6
+ {
7
+ "provider": "telegram",
8
+ "displayName": "Telegram",
9
+ "placement": "cloud",
10
+ "deprecated": false,
11
+ "available": true,
12
+ "setupFlow": "pairing_code",
13
+ "audiences": ["personal", "shared"],
14
+ "inboundCapabilities": ["text", "audio", "action"],
15
+ "outboundCapabilities": ["text", "markdown", "action"],
16
+ "deliveryMode": "unrestricted",
17
+ "managementOperations": [
18
+ "provider_account.list",
19
+ "provider_account.status",
20
+ "route.list",
21
+ "route.update",
22
+ "route.delete",
23
+ "setup.options",
24
+ "setup.start",
25
+ "setup.status"
26
+ ],
27
+ "providerData": {}
28
+ }
29
+ ]
30
+ }
31
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "target": "/messaging/route/delete",
3
+ "direction": "request",
4
+ "body": { "provider": "telegram", "placement": "cloud", "routeId": "route-1" }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "target": "/messaging/route/delete",
3
+ "direction": "response",
4
+ "body": { "success": true }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "target": "/messaging/route/list",
3
+ "direction": "request",
4
+ "body": { "provider": "telegram", "placement": "cloud", "audience": "personal" }
5
+ }
@@ -0,0 +1,37 @@
1
+ {
2
+ "target": "/messaging/route/list",
3
+ "direction": "response",
4
+ "body": {
5
+ "routes": [
6
+ {
7
+ "provider": "telegram",
8
+ "placement": "cloud",
9
+ "routeId": "route-1",
10
+ "accountId": "official-bot",
11
+ "conversationId": "chat-1",
12
+ "audience": "personal",
13
+ "externalActorId": "user-1",
14
+ "tenantId": "tenant-1",
15
+ "userId": "mhome-user-1",
16
+ "scopeId": "scope-1",
17
+ "displayName": "Telegram",
18
+ "enabled": true,
19
+ "providerData": {}
20
+ },
21
+ {
22
+ "provider": "feishu",
23
+ "placement": "local",
24
+ "routeId": "route-2",
25
+ "accountId": "app-1",
26
+ "conversationId": "chat-2",
27
+ "audience": "shared",
28
+ "tenantId": "tenant-1",
29
+ "scopeId": "scope-2",
30
+ "boundByUserId": "mhome-user-1",
31
+ "displayName": "Project room",
32
+ "enabled": true,
33
+ "providerData": {}
34
+ }
35
+ ]
36
+ }
37
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "target": "/messaging/route/update",
3
+ "direction": "request",
4
+ "body": {
5
+ "audience": "personal",
6
+ "provider": "telegram",
7
+ "placement": "cloud",
8
+ "routeId": "route-1",
9
+ "scopeId": "scope-1",
10
+ "enabled": false
11
+ }
12
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "target": "/messaging/route/update",
3
+ "direction": "response",
4
+ "body": {
5
+ "route": {
6
+ "provider": "telegram",
7
+ "placement": "cloud",
8
+ "routeId": "route-1",
9
+ "accountId": "official-bot",
10
+ "conversationId": "chat-1",
11
+ "audience": "personal",
12
+ "externalActorId": "user-1",
13
+ "tenantId": "tenant-1",
14
+ "userId": "mhome-user-1",
15
+ "scopeId": "scope-1",
16
+ "enabled": false,
17
+ "providerData": {}
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "target": "/messaging/setup/options",
3
+ "direction": "request",
4
+ "body": { "provider": "telegram", "placement": "local" }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "target": "/messaging/setup/options",
3
+ "direction": "response",
4
+ "body": { "options": { "tokenRequired": true } }
5
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "target": "/messaging/setup/start",
3
+ "direction": "request",
4
+ "body": {
5
+ "provider": "telegram",
6
+ "placement": "local",
7
+ "data": { "botToken": "secret" }
8
+ }
9
+ }