clawdbot-pipedrive 1.1.0 → 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.
- package/index.ts +103 -0
- package/install.sh +8 -3
- package/package.json +1 -1
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
CHANGED
|
@@ -28,14 +28,19 @@ echo
|
|
|
28
28
|
echo "[2/3] Setting up skill template..."
|
|
29
29
|
mkdir -p "$SKILL_DIR"
|
|
30
30
|
|
|
31
|
+
LATEST_FILE="$SKILL_DIR/SKILL.md.latest"
|
|
32
|
+
|
|
31
33
|
if [ -f "$SKILL_FILE" ]; then
|
|
32
|
-
echo " $SKILL_FILE already exists
|
|
33
|
-
|
|
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"
|
|
34
39
|
else
|
|
35
40
|
# Download template from GitHub
|
|
36
41
|
curl -sL "https://raw.githubusercontent.com/graileanu/clawdbot-pipedrive/master/examples/SKILL-TEMPLATE.md" -o "$SKILL_FILE"
|
|
37
42
|
echo " Created $SKILL_FILE"
|
|
38
|
-
echo "
|
|
43
|
+
echo " Customize this file for your organization's workflows."
|
|
39
44
|
fi
|
|
40
45
|
echo
|
|
41
46
|
|