@alvie-tech/paperclip-plugin-intercom 0.0.0-stage → 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Alvie
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.
package/README.md CHANGED
@@ -1,3 +1,60 @@
1
- # Temporary Holding Version
1
+ # @alvie-tech/paperclip-plugin-intercom
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A [Paperclip](https://github.com/paperclipai/paperclip) plugin that turns Intercom conversations into Paperclip issues.
4
+
5
+ One conversation is one issue. The first customer message creates the issue and assigns it to an agent. Each later customer message adds a comment to the same issue, reopens it when it was closed, and wakes the agent.
6
+
7
+ ## Why a plugin
8
+
9
+ Intercom signs its webhooks with HMAC-SHA1 (`X-Hub-Signature: sha1=…`), keyed by the client secret of the Intercom app. Paperclip routine triggers verify neither SHA-1 nor a secret they did not generate, and every trigger call creates a new issue. This plugin verifies the signature itself and keeps the conversation in one issue.
10
+
11
+ ## What it does with a delivery
12
+
13
+ 1. Refuses it unless `X-Hub-Signature` is the HMAC-SHA1 of the raw body with the configured client secret.
14
+ 2. Refuses it when `intercomAppId` is set and the delivery comes from another workspace.
15
+ 3. Acknowledges and ignores a topic outside `topics`, and Intercom's `ping`.
16
+ 4. Looks for the issue whose origin is this conversation (`originKind: plugin:alvie.intercom`, `originId: <conversation id>`).
17
+ 5. Creates it, or comments on it and sets it back to `todo` when it was `done`, `cancelled` or in `backlog`.
18
+ 6. Asks the host to wake the assignee.
19
+
20
+ A notification Intercom delivers twice is handled once. Two deliveries of the same conversation are handled in order, so they never create two issues.
21
+
22
+ The issue and its comments carry **no customer text**: only the conversation id, its inbox link and the topic. The agent reads the conversation through the Intercom API. Customer text is untrusted input and stays out of the task description.
23
+
24
+ ## Install
25
+
26
+ ```sh
27
+ paperclipai plugin install @alvie-tech/paperclip-plugin-intercom
28
+ ```
29
+
30
+ ## Configuration
31
+
32
+ | Key | Required | Meaning |
33
+ | --- | --- | --- |
34
+ | `companyId` | yes | Paperclip company that receives the issues |
35
+ | `assigneeAgentId` | yes | Agent assigned to every conversation issue |
36
+ | `clientSecret` | yes | Secret reference to the Intercom app client secret |
37
+ | `projectId` | no | Project of the created issues |
38
+ | `intercomAppId` | no | Intercom workspace id; other workspaces are refused |
39
+ | `topics` | no | Topics that create or update an issue. Default: `conversation.user.created`, `conversation.user.replied` |
40
+ | `titlePrefix` | no | Issue title prefix. Default: `Intercom` |
41
+
42
+ ## Intercom setup
43
+
44
+ In the Intercom Developer Hub, on the app whose client secret is configured above:
45
+
46
+ 1. Webhooks → endpoint URL: `https://<paperclip host>/api/plugins/<plugin id>/webhooks/conversations`.
47
+ 2. Subscribe to `conversation.user.created` and `conversation.user.replied`.
48
+
49
+ ## Development
50
+
51
+ ```sh
52
+ pnpm install
53
+ pnpm typecheck
54
+ pnpm test
55
+ pnpm build
56
+ ```
57
+
58
+ ## License
59
+
60
+ MIT
@@ -0,0 +1,85 @@
1
+ // src/constants.ts
2
+ var PLUGIN_ID = "alvie.intercom";
3
+ var ORIGIN_KIND = `plugin:${PLUGIN_ID}`;
4
+ var WEBHOOK_ENDPOINT_KEY = "conversations";
5
+ var DEFAULT_TOPICS = ["conversation.user.created", "conversation.user.replied"];
6
+
7
+ // src/manifest.ts
8
+ var manifest = {
9
+ id: PLUGIN_ID,
10
+ apiVersion: 1,
11
+ version: "0.1.0",
12
+ displayName: "Intercom",
13
+ description: "Turns Intercom conversations into Paperclip issues: one issue per conversation, reopened and commented on each customer reply.",
14
+ author: "Alvie",
15
+ categories: ["automation"],
16
+ capabilities: [
17
+ "issues.read",
18
+ "issues.create",
19
+ "issues.update",
20
+ "issues.wakeup",
21
+ "issue.comments.create",
22
+ "plugin.state.read",
23
+ "plugin.state.write",
24
+ "webhooks.receive",
25
+ "secrets.read-ref"
26
+ ],
27
+ entrypoints: {
28
+ worker: "./dist/worker.js"
29
+ },
30
+ instanceConfigSchema: {
31
+ type: "object",
32
+ required: ["companyId", "assigneeAgentId", "clientSecret"],
33
+ properties: {
34
+ companyId: {
35
+ type: "string",
36
+ title: "Company ID",
37
+ description: "Paperclip company that receives the issues."
38
+ },
39
+ assigneeAgentId: {
40
+ type: "string",
41
+ title: "Assignee agent ID",
42
+ description: "Agent assigned to every conversation issue."
43
+ },
44
+ projectId: {
45
+ type: "string",
46
+ title: "Project ID",
47
+ description: "Optional project of the created issues."
48
+ },
49
+ clientSecret: {
50
+ type: "object",
51
+ format: "secret-ref",
52
+ title: "Intercom client secret",
53
+ description: "Client secret of the Intercom app that sends the webhooks. Intercom signs each delivery with it (X-Hub-Signature, HMAC-SHA1)."
54
+ },
55
+ intercomAppId: {
56
+ type: "string",
57
+ title: "Intercom workspace ID",
58
+ description: "Optional. When set, deliveries from another workspace are refused."
59
+ },
60
+ topics: {
61
+ type: "array",
62
+ title: "Topics",
63
+ description: "Webhook topics that create or update an issue. Other topics are acknowledged and ignored.",
64
+ items: { type: "string" },
65
+ default: DEFAULT_TOPICS
66
+ },
67
+ titlePrefix: {
68
+ type: "string",
69
+ title: "Issue title prefix",
70
+ default: "Intercom"
71
+ }
72
+ }
73
+ },
74
+ webhooks: [
75
+ {
76
+ endpointKey: WEBHOOK_ENDPOINT_KEY,
77
+ displayName: "Intercom conversations",
78
+ description: "Receives Intercom conversation webhooks, signed with the app client secret."
79
+ }
80
+ ]
81
+ };
82
+ var manifest_default = manifest;
83
+ export {
84
+ manifest_default as default
85
+ };