@ever-works/discord-connector-plugin 1.0.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.
- package/README.md +42 -0
- package/dist/index.cjs +862 -0
- package/dist/index.d.cts +36 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.js +859 -0
- package/package.json +108 -0
package/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# @ever-works/discord-connector-plugin
|
|
2
|
+
|
|
3
|
+
First-party **Discord connector** for the Ever Works platform — a bidirectional
|
|
4
|
+
communication-channel plugin (the `connector` category). This increment ships the
|
|
5
|
+
**outbound** leg; inbound Interactions API routing (verify → pair → route to an
|
|
6
|
+
Agent → reply) is a follow-up.
|
|
7
|
+
|
|
8
|
+
- **Category**: `connector`
|
|
9
|
+
- **Capabilities**: `connector`, `connector-discord`
|
|
10
|
+
- **Direction**: `outbound` (metadata is inbound-ready; the `publicKey`
|
|
11
|
+
setting is captured now so inbound needs no reconfiguration in P2)
|
|
12
|
+
- **Transport**: official `discord.js` SDK (`REST` client →
|
|
13
|
+
`POST /channels/:id/messages`) with a bot token — distinct from
|
|
14
|
+
`discord-channel`'s incoming-webhook `fetch` path. A connector is a superset
|
|
15
|
+
of a channel; both coexist.
|
|
16
|
+
- **Rich outbound**: Discord embeds via the `discord-embeds` rich payload kind.
|
|
17
|
+
|
|
18
|
+
## Connection config (`targetConfig`)
|
|
19
|
+
|
|
20
|
+
| Key | Required | Secret | Description |
|
|
21
|
+
| ------------------ | -------- | ------ | -------------------------------------------------------------------------------------------- |
|
|
22
|
+
| `botToken` | Yes | Yes | Bot token. Env fallback `DISCORD_BOT_TOKEN`. |
|
|
23
|
+
| `publicKey` | No | Yes | Application public key for inbound Interactions API (P2). Env fallback `DISCORD_PUBLIC_KEY`. |
|
|
24
|
+
| `applicationId` | No | No | Discord application (client) id. |
|
|
25
|
+
| `guildId` | No | No | Default guild/server id. |
|
|
26
|
+
| `defaultChannelId` | No | No | Default destination channel (e.g. `123456789012345678`). |
|
|
27
|
+
| `channelId` | No | No | Per-send channel override (takes precedence over the default). |
|
|
28
|
+
|
|
29
|
+
The `discord.js` `REST` client pins the host to `discord.com` and injects the
|
|
30
|
+
`Authorization: Bot <token>` header, so there is no SSRF surface. `send` is
|
|
31
|
+
idempotent on `messageRef`, scoped to `connectorId` + channel. `verifyConnection`
|
|
32
|
+
calls `GET /users/@me` to validate the bot token.
|
|
33
|
+
|
|
34
|
+
## Follow-ups
|
|
35
|
+
|
|
36
|
+
- **Inbound (P2)**: Discord Interactions API — `verifyInbound` (Ed25519 signature
|
|
37
|
+
over `X-Signature-Ed25519` + `X-Signature-Timestamp`), `handleChallenge` for the
|
|
38
|
+
`PING` handshake, `parseInbound` → route to an Agent, `reply` into the channel.
|
|
39
|
+
- **Sibling connectors**: `slack-connector` (shipped), then `whatsapp-connector`,
|
|
40
|
+
`notion-connector`, `microsoft-365-connector` (P3).
|
|
41
|
+
|
|
42
|
+
Refs spec: [`docs/specs/features/connectors/spec.md`](../../../docs/specs/features/connectors/spec.md) §7.5.1.
|