@kanvas/openclaw-plugin 0.1.8 → 0.1.9
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/dist/domains/crm/index.js +20 -4
- package/package.json +1 -1
|
@@ -369,12 +369,13 @@ export class CrmService {
|
|
|
369
369
|
});
|
|
370
370
|
}
|
|
371
371
|
async addLeadMessageByLeadId(input) {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
372
|
+
// The channel_slug for lead notes must be the lead's UUID
|
|
373
|
+
const leadUuid = await this.getLeadUuid(String(input.leadId));
|
|
374
|
+
if (!leadUuid) {
|
|
375
|
+
throw new Error(`Lead ${input.leadId} not found`);
|
|
375
376
|
}
|
|
376
377
|
const created = await this.addLeadMessage({
|
|
377
|
-
channel_slug:
|
|
378
|
+
channel_slug: leadUuid,
|
|
378
379
|
message: input.message,
|
|
379
380
|
parent_id: input.parent_id,
|
|
380
381
|
is_public: input.is_public,
|
|
@@ -442,6 +443,21 @@ export class CrmService {
|
|
|
442
443
|
`;
|
|
443
444
|
return this.client.query(query, { first, page, channelSlug });
|
|
444
445
|
}
|
|
446
|
+
async getLeadUuid(leadId) {
|
|
447
|
+
const response = await this.client.query(`
|
|
448
|
+
query LeadUuid($first: Int!, $where: QueryLeadsWhereWhereConditions) {
|
|
449
|
+
leads(first: $first, where: $where) {
|
|
450
|
+
data {
|
|
451
|
+
uuid
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
`, {
|
|
456
|
+
first: 1,
|
|
457
|
+
where: { column: "ID", operator: "EQ", value: leadId },
|
|
458
|
+
});
|
|
459
|
+
return response.data?.leads?.data?.[0]?.uuid ?? null;
|
|
460
|
+
}
|
|
445
461
|
async getLeadPrimaryChannelSlug(leadId) {
|
|
446
462
|
const response = await this.client.query(`
|
|
447
463
|
query LeadChannels($first: Int!, $where: QueryLeadsWhereWhereConditions) {
|
package/package.json
CHANGED