clawdbot-pipedrive 1.0.2 → 1.2.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 (4) hide show
  1. package/README.md +11 -3
  2. package/index.ts +103 -0
  3. package/install.sh +73 -0
  4. package/package.json +1 -1
package/README.md CHANGED
@@ -14,13 +14,21 @@ Pipedrive CRM integration plugin for [Clawdbot](https://clawd.bot).
14
14
 
15
15
  ## Installation
16
16
 
17
+ ### Quick Install (recommended)
18
+
17
19
  ```bash
18
- clawdbot plugins install clawdbot-pipedrive
20
+ curl -sL https://raw.githubusercontent.com/graileanu/clawdbot-pipedrive/master/install.sh | bash
19
21
  ```
20
22
 
21
- Or via npm directly: https://www.npmjs.com/package/clawdbot-pipedrive
23
+ This installs the plugin AND sets up the skill template (won't overwrite existing files).
24
+
25
+ ### Manual Install
26
+
27
+ ```bash
28
+ clawdbot plugins install clawdbot-pipedrive
29
+ ```
22
30
 
23
- Manual: copy to `~/.clawdbot/extensions/pipedrive/`
31
+ npm: https://www.npmjs.com/package/clawdbot-pipedrive
24
32
 
25
33
  ## Configuration
26
34
 
package/index.ts CHANGED
@@ -1,4 +1,104 @@
1
1
  import { Type } from "@sinclair/typebox";
2
+ import { existsSync, mkdirSync, writeFileSync, readFileSync } from "node:fs";
3
+ import { join } from "node:path";
4
+ import { homedir } from "node:os";
5
+
6
+ // Skill template - embedded so it works without network access
7
+ const SKILL_TEMPLATE = `# Pipedrive CRM Workflows
8
+
9
+ > Customize this file for your organization's Pipedrive workflows.
10
+ > This file will NOT be overwritten by plugin updates.
11
+
12
+ ## Deal Naming Convention
13
+
14
+ When creating deals, use this format:
15
+ - **Title**: \`[Company Name] - [Product/Plan] - [Value]\`
16
+ - Example: \`Acme Corp - Enterprise - $2,500/mo\`
17
+
18
+ ## Pipeline Stages
19
+
20
+ | Stage ID | Name | When to use |
21
+ |----------|------|-------------|
22
+ | 1 | Lead | Initial contact |
23
+ | 2 | Qualified | Confirmed interest |
24
+ | 3 | Proposal | Pricing sent |
25
+ | 4 | Negotiation | Active discussions |
26
+ | 5 | Closed Won | Deal signed |
27
+ | 6 | Closed Lost | Deal lost |
28
+
29
+ > **Note**: Replace stage IDs with your actual Pipedrive stage IDs.
30
+ > Find them via: \`pipedrive_list_stages\`
31
+
32
+ ## Required Fields
33
+
34
+ When creating deals, always include:
35
+ - \`title\` - Following naming convention above
36
+ - \`value\` - Deal value in your currency
37
+ - \`person_id\` or \`org_id\` - Link to contact/company
38
+
39
+ ## Activity Types
40
+
41
+ | Type | Use for | Subject format |
42
+ |------|---------|----------------|
43
+ | \`call\` | Phone calls | "Call: [topic]" |
44
+ | \`meeting\` | Demos, meetings | "Meeting: [purpose]" |
45
+ | \`task\` | Follow-ups, to-dos | "Task: [action]" |
46
+ | \`email\` | Email follow-ups | "Email: [subject]" |
47
+
48
+ ## Common Workflows
49
+
50
+ ### New Lead
51
+ 1. Search if contact exists: \`pipedrive_search_persons\`
52
+ 2. Create person if new: \`pipedrive_create_person\`
53
+ 3. Create deal: \`pipedrive_create_deal\`
54
+ 4. Schedule follow-up: \`pipedrive_create_activity\`
55
+
56
+ ### After Demo
57
+ 1. Update deal stage: \`pipedrive_update_deal\` with next stage_id
58
+ 2. Add notes: \`pipedrive_create_note\`
59
+ 3. Create follow-up task: \`pipedrive_create_activity\`
60
+
61
+ ### Close Won
62
+ 1. Update deal: \`pipedrive_update_deal\` with \`status: "won"\`
63
+ 2. Add closing note: \`pipedrive_create_note\`
64
+
65
+ ### Close Lost
66
+ 1. Update deal: \`pipedrive_update_deal\` with \`status: "lost"\` and \`lost_reason\`
67
+ `;
68
+
69
+ /**
70
+ * Sets up the skill template file
71
+ * - Creates skill if it doesn't exist
72
+ * - If skill exists, saves new template as .latest for comparison
73
+ */
74
+ function setupSkillTemplate(): void {
75
+ const skillDir = join(homedir(), ".clawdbot", "skills", "pipedrive");
76
+ const skillFile = join(skillDir, "SKILL.md");
77
+ const latestFile = join(skillDir, "SKILL.md.latest");
78
+
79
+ try {
80
+ mkdirSync(skillDir, { recursive: true });
81
+
82
+ if (!existsSync(skillFile)) {
83
+ // First install - create the skill file
84
+ writeFileSync(skillFile, SKILL_TEMPLATE);
85
+ console.log(`[pipedrive] Created skill template: ${skillFile}`);
86
+ console.log("[pipedrive] Customize this file with your organization's workflows.");
87
+ } else {
88
+ // Skill exists - check if template has changed
89
+ const existing = readFileSync(skillFile, "utf-8");
90
+ if (existing !== SKILL_TEMPLATE) {
91
+ // Save latest template for comparison
92
+ writeFileSync(latestFile, SKILL_TEMPLATE);
93
+ console.log(`[pipedrive] Skill file exists: ${skillFile} (not modified)`);
94
+ console.log(`[pipedrive] New template available: ${latestFile}`);
95
+ console.log("[pipedrive] Compare with: diff ~/.clawdbot/skills/pipedrive/SKILL.md{,.latest}");
96
+ }
97
+ }
98
+ } catch (err) {
99
+ console.warn("[pipedrive] Could not set up skill template:", err);
100
+ }
101
+ }
2
102
 
3
103
  type PipedriveConfig = {
4
104
  apiKey?: string;
@@ -50,6 +150,9 @@ const plugin: ClawdbotPluginDefinition = {
50
150
  },
51
151
 
52
152
  register(api) {
153
+ // Set up skill template on first run
154
+ setupSkillTemplate();
155
+
53
156
  const cfg = api.pluginConfig as PipedriveConfig;
54
157
 
55
158
  if (!cfg.apiKey || !cfg.domain) {
package/install.sh ADDED
@@ -0,0 +1,73 @@
1
+ #!/bin/bash
2
+ #
3
+ # clawdbot-pipedrive installer
4
+ # Installs the plugin and sets up the skill template
5
+ #
6
+
7
+ set -e
8
+
9
+ SKILL_DIR="$HOME/.clawdbot/skills/pipedrive"
10
+ SKILL_FILE="$SKILL_DIR/SKILL.md"
11
+ CONFIG_FILE="$HOME/.clawdbot/config.json"
12
+
13
+ echo "=== clawdbot-pipedrive installer ==="
14
+ echo
15
+
16
+ # 1. Install plugin
17
+ echo "[1/3] Installing plugin..."
18
+ if command -v clawdbot &> /dev/null; then
19
+ clawdbot plugins install clawdbot-pipedrive
20
+ else
21
+ echo " clawdbot not found. Installing via npm..."
22
+ npm install -g clawdbot-pipedrive
23
+ fi
24
+ echo " Done."
25
+ echo
26
+
27
+ # 2. Set up skill template
28
+ echo "[2/3] Setting up skill template..."
29
+ mkdir -p "$SKILL_DIR"
30
+
31
+ LATEST_FILE="$SKILL_DIR/SKILL.md.latest"
32
+
33
+ if [ -f "$SKILL_FILE" ]; then
34
+ echo " $SKILL_FILE already exists (not overwriting your customizations)."
35
+ # Download latest template for comparison
36
+ curl -sL "https://raw.githubusercontent.com/graileanu/clawdbot-pipedrive/master/examples/SKILL-TEMPLATE.md" -o "$LATEST_FILE"
37
+ echo " Latest template saved to: $LATEST_FILE"
38
+ echo " Compare changes: diff $SKILL_FILE $LATEST_FILE"
39
+ else
40
+ # Download template from GitHub
41
+ curl -sL "https://raw.githubusercontent.com/graileanu/clawdbot-pipedrive/master/examples/SKILL-TEMPLATE.md" -o "$SKILL_FILE"
42
+ echo " Created $SKILL_FILE"
43
+ echo " Customize this file for your organization's workflows."
44
+ fi
45
+ echo
46
+
47
+ # 3. Config reminder
48
+ echo "[3/3] Configuration..."
49
+ echo " Add to $CONFIG_FILE:"
50
+ echo
51
+ echo ' {
52
+ "plugins": {
53
+ "entries": {
54
+ "clawdbot-pipedrive": {
55
+ "enabled": true,
56
+ "config": {
57
+ "apiKey": "YOUR_PIPEDRIVE_API_KEY",
58
+ "domain": "YOUR_COMPANY"
59
+ }
60
+ }
61
+ }
62
+ }
63
+ }'
64
+ echo
65
+ echo " Get your API key: Pipedrive > Settings > Personal preferences > API"
66
+ echo
67
+
68
+ echo "=== Installation complete ==="
69
+ echo
70
+ echo "Next steps:"
71
+ echo " 1. Add your Pipedrive config to ~/.clawdbot/config.json"
72
+ echo " 2. Customize ~/.clawdbot/skills/pipedrive/SKILL.md"
73
+ echo " 3. Restart clawdbot"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawdbot-pipedrive",
3
- "version": "1.0.2",
3
+ "version": "1.2.0",
4
4
  "type": "module",
5
5
  "description": "Pipedrive CRM integration for Clawdbot",
6
6
  "author": "graileanu",