Skip to content

Commit c6a08a4

Browse files
committed
fix(smartlead): preserve a zero-day next-sequence delay and render enum values in docs
A next sequence scheduled to send immediately reported no delay at all: `Number(next.delayInDays) || null` mapped a legitimate 0 to null. Tool descriptions built enum lists with template literals. The runtime value and the LLM-facing tool metadata were correct, but the docs generator reads the description statically, so the public page rendered `${SMARTLEAD_CAMPAIGN_STATUSES.join(...)}` instead of START, PAUSED, STOPPED. The five affected descriptions now spell the values out.
1 parent 9aa6963 commit c6a08a4

6 files changed

Lines changed: 20 additions & 16 deletions

File tree

apps/docs/content/docs/en/integrations/smartlead.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ Starts, pauses, or stops a Smartlead campaign. START requires the campaign to al
303303

304304
| Parameter | Type | Required | Description |
305305
| --------- | ---- | -------- | ----------- |
306-
| `status` | string | Yes | Target status: $\{SMARTLEAD_CAMPAIGN_STATUSES.join\(', '\)\} |
306+
| `status` | string | Yes | Target status: START, PAUSED, STOPPED |
307307

308308
#### Output
309309

@@ -493,8 +493,8 @@ Updates tracking, stop-on-activity, and sending settings for a Smartlead campaig
493493

494494
| Parameter | Type | Required | Description |
495495
| --------- | ---- | -------- | ----------- |
496-
| `trackSettings` | array | No | Tracking to disable. Allowed values: $\{SMARTLEAD_TRACK_SETTINGS.join\(', '\)\} |
497-
| `stopLeadSettings` | string | No | Lead activity that stops the sequence: $\{SMARTLEAD_STOP_LEAD_SETTINGS.join\(', '\)\} |
496+
| `trackSettings` | array | No | Tracking to disable. Allowed values: DONT_TRACK_EMAIL_OPEN, DONT_TRACK_LINK_CLICK, DONT_TRACK_REPLY_TO_AN_EMAIL |
497+
| `stopLeadSettings` | string | No | Lead activity that stops the sequence: REPLY_TO_AN_EMAIL, CLICK_ON_A_LINK, OPEN_AN_EMAIL |
498498
| `sendAsPlainText` | boolean | No | Send campaign emails as plain text |
499499
| `followUpPercentage` | number | No | Percentage of leads that receive follow-ups |
500500
| `unsubscribeText` | string | No | Unsubscribe text appended to emails |
@@ -960,7 +960,7 @@ Retrieves per-email statistics rows for a Smartlead campaign, filterable by sequ
960960
| `offset` | number | No | Pagination offset \(default 0\) |
961961
| `limit` | number | No | Rows to return \(default 100\) |
962962
| `emailSequenceNumber` | number | No | Only return rows for this sequence step |
963-
| `emailStatus` | string | No | Only return rows with this engagement status: $\{SMARTLEAD_EMAIL_STATUSES.join\(', '\)\} |
963+
| `emailStatus` | string | No | Only return rows with this engagement status: opened, clicked, replied, unsubscribed, bounced |
964964
| `sentTimeStartDate` | string | No | Only return rows sent on or after this date \(YYYY-MM-DD\) |
965965
| `sentTimeEndDate` | string | No | Only return rows sent on or before this date \(YYYY-MM-DD\) |
966966

@@ -1987,7 +1987,7 @@ Creates a webhook on a Smartlead campaign, or updates an existing one when a web
19871987
| --------- | ---- | -------- | ----------- |
19881988
| `name` | string | Yes | Webhook name |
19891989
| `webhookUrl` | string | Yes | HTTPS URL Smartlead should post events to |
1990-
| `eventTypes` | array | Yes | Events to subscribe to. Allowed values: $\{SMARTLEAD_WEBHOOK_EVENT_TYPES.join\(', '\)\} |
1990+
| `eventTypes` | array | Yes | Events to subscribe to. Allowed values: EMAIL_SENT, EMAIL_OPEN, EMAIL_LINK_CLICK, EMAIL_REPLY, EMAIL_BOUNCE, LEAD_UNSUBSCRIBED, LEAD_CATEGORY_UPDATED |
19911991
| `categories` | array | Yes | Lead category names the webhook applies to, e.g. Interested. Smartlead rejects an empty list. |
19921992
| `webhookId` | number | No | Existing webhook ID to update; omit to create a new webhook |
19931993

apps/sim/tools/smartlead/get_campaign_statistics.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type {
66
import {
77
campaignStatisticsOutputs,
88
pathSegment,
9-
SMARTLEAD_EMAIL_STATUSES,
9+
type SMARTLEAD_EMAIL_STATUSES,
1010
smartleadBaseParamFields,
1111
smartleadCampaignIdParamField,
1212
smartleadHeaders,
@@ -59,7 +59,8 @@ export const getCampaignStatisticsTool: ToolConfig<
5959
type: 'string',
6060
required: false,
6161
visibility: 'user-or-llm',
62-
description: `Only return rows with this engagement status: ${SMARTLEAD_EMAIL_STATUSES.join(', ')}`,
62+
description:
63+
'Only return rows with this engagement status: opened, clicked, replied, unsubscribed, bounced',
6364
},
6465
sentTimeStartDate: {
6566
type: 'string',

apps/sim/tools/smartlead/mark_lead_complete.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,17 @@ export const markLeadCompleteTool: ToolConfig<
5555
const record = await smartleadRecord(response, 'lead completion')
5656
const status = isRecordLike(record.status) ? record.status : {}
5757
// `nextSequence` is an object ({ id, delayInDays }) when a step remains, else null.
58+
// `delayInDays` arrives as a string and is legitimately "0" for an immediate step.
5859
const next = isRecordLike(status.nextSequence) ? status.nextSequence : null
60+
const delay = next === null ? Number.NaN : Number(next.delayInDays)
5961

6062
return {
6163
success: true,
6264
output: {
6365
success: isOk(record),
6466
is_last_sequence: typeof status.isLastSequence === 'boolean' ? status.isLastSequence : null,
6567
next_sequence_id: next && typeof next.id === 'number' ? next.id : null,
66-
next_sequence_delay_in_days: next ? Number(next.delayInDays) || null : null,
68+
next_sequence_delay_in_days: Number.isFinite(delay) ? delay : null,
6769
},
6870
}
6971
},

apps/sim/tools/smartlead/update_campaign_settings.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import {
55
isOk,
66
jsonBody,
77
pathSegment,
8-
SMARTLEAD_STOP_LEAD_SETTINGS,
9-
SMARTLEAD_TRACK_SETTINGS,
8+
type SMARTLEAD_STOP_LEAD_SETTINGS,
109
smartleadBaseParamFields,
1110
smartleadCampaignIdParamField,
1211
smartleadHeaders,
@@ -40,14 +39,16 @@ export const updateCampaignSettingsTool: ToolConfig<
4039
type: 'array',
4140
required: false,
4241
visibility: 'user-or-llm',
43-
description: `Tracking to disable. Allowed values: ${SMARTLEAD_TRACK_SETTINGS.join(', ')}`,
42+
description:
43+
'Tracking to disable. Allowed values: DONT_TRACK_EMAIL_OPEN, DONT_TRACK_LINK_CLICK, DONT_TRACK_REPLY_TO_AN_EMAIL',
4444
items: { type: 'string' },
4545
},
4646
stopLeadSettings: {
4747
type: 'string',
4848
required: false,
4949
visibility: 'user-or-llm',
50-
description: `Lead activity that stops the sequence: ${SMARTLEAD_STOP_LEAD_SETTINGS.join(', ')}`,
50+
description:
51+
'Lead activity that stops the sequence: REPLY_TO_AN_EMAIL, CLICK_ON_A_LINK, OPEN_AN_EMAIL',
5152
},
5253
sendAsPlainText: {
5354
type: 'boolean',

apps/sim/tools/smartlead/update_campaign_status.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
actionOutputs,
55
isOk,
66
pathSegment,
7-
SMARTLEAD_CAMPAIGN_STATUSES,
7+
type SMARTLEAD_CAMPAIGN_STATUSES,
88
smartleadBaseParamFields,
99
smartleadCampaignIdParamField,
1010
smartleadHeaders,
@@ -34,7 +34,7 @@ export const updateCampaignStatusTool: ToolConfig<
3434
type: 'string',
3535
required: true,
3636
visibility: 'user-or-llm',
37-
description: `Target status: ${SMARTLEAD_CAMPAIGN_STATUSES.join(', ')}`,
37+
description: 'Target status: START, PAUSED, STOPPED',
3838
},
3939
},
4040
request: {

apps/sim/tools/smartlead/upsert_campaign_webhook.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import type {
66
import {
77
mapSavedWebhook,
88
pathSegment,
9-
SMARTLEAD_WEBHOOK_EVENT_TYPES,
109
smartleadBaseParamFields,
1110
smartleadCampaignIdParamField,
1211
smartleadHeaders,
@@ -53,7 +52,8 @@ export const upsertCampaignWebhookTool: ToolConfig<
5352
type: 'array',
5453
required: true,
5554
visibility: 'user-or-llm',
56-
description: `Events to subscribe to. Allowed values: ${SMARTLEAD_WEBHOOK_EVENT_TYPES.join(', ')}`,
55+
description:
56+
'Events to subscribe to. Allowed values: EMAIL_SENT, EMAIL_OPEN, EMAIL_LINK_CLICK, EMAIL_REPLY, EMAIL_BOUNCE, LEAD_UNSUBSCRIBED, LEAD_CATEGORY_UPDATED',
5757
items: { type: 'string' },
5858
},
5959
categories: {

0 commit comments

Comments
 (0)