chore: import upstream snapshot with attribution
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
import type {
|
||||
SendblueEvaluateServiceParams,
|
||||
SendblueEvaluateServiceResponse,
|
||||
} from '@/tools/sendblue/types'
|
||||
import {
|
||||
SENDBLUE_API_BASE_URL,
|
||||
sendblueBaseParamFields,
|
||||
sendblueHeaders,
|
||||
} from '@/tools/sendblue/utils'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const sendblueEvaluateServiceTool: ToolConfig<
|
||||
SendblueEvaluateServiceParams,
|
||||
SendblueEvaluateServiceResponse
|
||||
> = {
|
||||
id: 'sendblue_evaluate_service',
|
||||
name: 'Sendblue Evaluate Service',
|
||||
description: 'Check whether a phone number can receive iMessage or only SMS.',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
...sendblueBaseParamFields,
|
||||
number: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Phone number to evaluate, in E.164 format (e.g., +19998887777)',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params) => {
|
||||
const url = new URL(`${SENDBLUE_API_BASE_URL}/api/evaluate-service`)
|
||||
url.searchParams.set('number', params.number.trim())
|
||||
return url.toString()
|
||||
},
|
||||
method: 'GET',
|
||||
headers: (params) => sendblueHeaders(params),
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
number: data.number ?? null,
|
||||
service: data.service ?? null,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
number: { type: 'string', description: 'The evaluated phone number in E.164 format' },
|
||||
service: { type: 'string', description: 'The service the number supports: iMessage or SMS' },
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
import type { SendblueGetMessageParams, SendblueGetMessageResponse } from '@/tools/sendblue/types'
|
||||
import {
|
||||
SENDBLUE_API_BASE_URL,
|
||||
sendblueBaseParamFields,
|
||||
sendblueHeaders,
|
||||
} from '@/tools/sendblue/utils'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const sendblueGetMessageTool: ToolConfig<
|
||||
SendblueGetMessageParams,
|
||||
SendblueGetMessageResponse
|
||||
> = {
|
||||
id: 'sendblue_get_message',
|
||||
name: 'Sendblue Get Message',
|
||||
description: 'Retrieve a single message and its current status by message handle/ID.',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
...sendblueBaseParamFields,
|
||||
message_id: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The message handle/ID returned when the message was sent.',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params) =>
|
||||
`${SENDBLUE_API_BASE_URL}/api/v2/messages/${encodeURIComponent(params.message_id.trim())}`,
|
||||
method: 'GET',
|
||||
headers: (params) => sendblueHeaders(params),
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const body = await response.json()
|
||||
const data = body?.data ?? body ?? {}
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
status: data.status ?? null,
|
||||
message_handle: data.message_handle ?? null,
|
||||
account_email: data.accountEmail ?? data.account_email ?? null,
|
||||
content: data.content ?? null,
|
||||
is_outbound: data.is_outbound ?? null,
|
||||
from_number: data.from_number ?? null,
|
||||
number: data.number ?? null,
|
||||
to_number: data.to_number ?? null,
|
||||
media_url: data.media_url ?? null,
|
||||
message_type: data.message_type ?? null,
|
||||
service: data.service ?? null,
|
||||
group_id: data.group_id ?? null,
|
||||
group_display_name: data.group_display_name ?? null,
|
||||
participants: data.participants ?? [],
|
||||
send_style: data.send_style ?? null,
|
||||
was_downgraded: data.was_downgraded ?? null,
|
||||
opted_out: data.opted_out ?? null,
|
||||
plan: data.plan ?? null,
|
||||
sendblue_number: data.sendblue_number ?? null,
|
||||
seat_id: data.seat_id ?? null,
|
||||
sender_email: data.sender_email ?? null,
|
||||
error_code: data.error_code ?? null,
|
||||
error_message: data.error_message ?? null,
|
||||
error_reason: data.error_reason ?? null,
|
||||
error_detail: data.error_detail ?? null,
|
||||
date_sent: data.date_sent ?? null,
|
||||
date_updated: data.date_updated ?? null,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
status: { type: 'string', description: 'Current message status' },
|
||||
message_handle: { type: 'string', description: 'Unique message identifier' },
|
||||
account_email: { type: 'string', description: 'Email of the account', optional: true },
|
||||
content: { type: 'string', description: 'Message content', optional: true },
|
||||
is_outbound: {
|
||||
type: 'boolean',
|
||||
description: 'Whether the message is outbound',
|
||||
optional: true,
|
||||
},
|
||||
from_number: { type: 'string', description: 'Sending phone number', optional: true },
|
||||
number: { type: 'string', description: 'Recipient phone number', optional: true },
|
||||
to_number: { type: 'string', description: 'Destination phone number', optional: true },
|
||||
media_url: { type: 'string', description: 'URL of attached media', optional: true },
|
||||
message_type: {
|
||||
type: 'string',
|
||||
description: 'Message category: message or group',
|
||||
optional: true,
|
||||
},
|
||||
service: {
|
||||
type: 'string',
|
||||
description: 'Messaging service: iMessage, SMS, or RCS',
|
||||
optional: true,
|
||||
},
|
||||
group_id: {
|
||||
type: 'string',
|
||||
description: 'Group identifier (empty for non-group)',
|
||||
optional: true,
|
||||
},
|
||||
group_display_name: { type: 'string', description: 'Group chat name', optional: true },
|
||||
participants: {
|
||||
type: 'array',
|
||||
description: 'Participant phone numbers',
|
||||
items: { type: 'string' },
|
||||
optional: true,
|
||||
},
|
||||
send_style: { type: 'string', description: 'Expressive style applied', optional: true },
|
||||
was_downgraded: {
|
||||
type: 'boolean',
|
||||
description: 'True if the recipient lacks iMessage support',
|
||||
optional: true,
|
||||
},
|
||||
opted_out: {
|
||||
type: 'boolean',
|
||||
description: 'True if the recipient has opted out',
|
||||
optional: true,
|
||||
},
|
||||
plan: { type: 'string', description: 'Account plan type', optional: true },
|
||||
sendblue_number: { type: 'string', description: 'Sendblue phone number used', optional: true },
|
||||
seat_id: { type: 'string', description: 'Seat UUID', optional: true },
|
||||
sender_email: { type: 'string', description: 'Email of the sending seat', optional: true },
|
||||
error_code: { type: 'number', description: 'Numeric error code if failed', optional: true },
|
||||
error_message: { type: 'string', description: 'Error message if failed', optional: true },
|
||||
error_reason: { type: 'string', description: 'Additional error context', optional: true },
|
||||
error_detail: { type: 'string', description: 'Detailed error information', optional: true },
|
||||
date_sent: { type: 'string', description: 'ISO 8601 creation timestamp', optional: true },
|
||||
date_updated: { type: 'string', description: 'ISO 8601 last-update timestamp', optional: true },
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export { sendblueEvaluateServiceTool } from '@/tools/sendblue/evaluate_service'
|
||||
export { sendblueGetMessageTool } from '@/tools/sendblue/get_message'
|
||||
export { sendblueSendGroupMessageTool } from '@/tools/sendblue/send_group_message'
|
||||
export { sendblueSendMessageTool } from '@/tools/sendblue/send_message'
|
||||
export { sendblueSendTypingIndicatorTool } from '@/tools/sendblue/send_typing_indicator'
|
||||
export * from '@/tools/sendblue/types'
|
||||
@@ -0,0 +1,184 @@
|
||||
import { filterUndefined } from '@sim/utils/object'
|
||||
import type {
|
||||
SendblueSendGroupMessageParams,
|
||||
SendblueSendGroupMessageResponse,
|
||||
} from '@/tools/sendblue/types'
|
||||
import {
|
||||
SENDBLUE_API_BASE_URL,
|
||||
sendblueBaseParamFields,
|
||||
sendblueHeaders,
|
||||
} from '@/tools/sendblue/utils'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const sendblueSendGroupMessageTool: ToolConfig<
|
||||
SendblueSendGroupMessageParams,
|
||||
SendblueSendGroupMessageResponse
|
||||
> = {
|
||||
id: 'sendblue_send_group_message',
|
||||
name: 'Sendblue Send Group Message',
|
||||
description: 'Send an iMessage or SMS to a group of recipients via Sendblue.',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
...sendblueBaseParamFields,
|
||||
numbers: {
|
||||
type: 'array',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Recipient phone numbers in E.164 format (e.g., ["+19998887777", "+13334445555"]). Optional when sending to an existing group via group_id.',
|
||||
items: { type: 'string', description: 'Phone number in E.164 format' },
|
||||
},
|
||||
from_number: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'One of your registered Sendblue phone numbers to send from, in E.164 format (e.g., +18887776666)',
|
||||
},
|
||||
content: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Message text content. Either content or media_url must be provided.',
|
||||
},
|
||||
media_url: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'URL of a media file to send. Either content or media_url must be provided.',
|
||||
},
|
||||
send_style: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'iMessage expressive style (e.g., celebration, fireworks, lasers, confetti, balloons, invisible, slam).',
|
||||
},
|
||||
seat_id: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Seat (user) the message is attributed to. Accepts the seat UUID or Firebase Auth subject.',
|
||||
},
|
||||
group_id: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Unique identifier of an existing group to send to. Omit to start a new group.',
|
||||
},
|
||||
status_callback: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
description: 'Webhook URL that Sendblue will POST message status updates to.',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: `${SENDBLUE_API_BASE_URL}/api/send-group-message`,
|
||||
method: 'POST',
|
||||
headers: (params) => sendblueHeaders(params),
|
||||
body: (params) => {
|
||||
const numbers = Array.isArray(params.numbers)
|
||||
? params.numbers.map((n) => n.trim()).filter(Boolean)
|
||||
: undefined
|
||||
const hasNumbers = numbers !== undefined && numbers.length > 0
|
||||
const hasGroupId = typeof params.group_id === 'string' && params.group_id.trim().length > 0
|
||||
if (!hasNumbers && !hasGroupId) {
|
||||
throw new Error(
|
||||
'Provide either "numbers" to start a new group or "group_id" to message an existing group.'
|
||||
)
|
||||
}
|
||||
return filterUndefined({
|
||||
numbers: hasNumbers ? numbers : undefined,
|
||||
from_number: params.from_number,
|
||||
content: params.content,
|
||||
media_url: params.media_url,
|
||||
send_style: params.send_style,
|
||||
seat_id: params.seat_id,
|
||||
group_id: hasGroupId ? params.group_id?.trim() : undefined,
|
||||
status_callback: params.status_callback,
|
||||
})
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
status: data.status ?? null,
|
||||
message_handle: data.message_handle ?? null,
|
||||
account_email: data.account_email ?? data.accountEmail ?? null,
|
||||
content: data.content ?? null,
|
||||
is_outbound: data.is_outbound ?? null,
|
||||
from_number: data.from_number ?? null,
|
||||
number: data.number ?? null,
|
||||
media_url: data.media_url ?? null,
|
||||
send_style: data.send_style ?? null,
|
||||
seat_id: data.seat_id ?? null,
|
||||
sender_email: data.sender_email ?? null,
|
||||
error_code: data.error_code ?? null,
|
||||
error_message: data.error_message ?? null,
|
||||
date_created: data.date_created ?? null,
|
||||
date_updated: data.date_updated ?? null,
|
||||
group_id: data.group_id ?? null,
|
||||
participants: data.participants ?? [],
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
status: { type: 'string', description: 'Message status: QUEUED, SENT, DELIVERED, or ERROR' },
|
||||
message_handle: { type: 'string', description: 'Unique identifier for tracking the message' },
|
||||
group_id: {
|
||||
type: 'string',
|
||||
description: 'Identifier of the group the message was sent to',
|
||||
optional: true,
|
||||
},
|
||||
participants: {
|
||||
type: 'array',
|
||||
description: 'Phone numbers participating in the group',
|
||||
items: { type: 'string' },
|
||||
},
|
||||
account_email: { type: 'string', description: 'Email of the account that sent the message' },
|
||||
content: { type: 'string', description: 'Message content', optional: true },
|
||||
is_outbound: { type: 'boolean', description: 'Whether this is an outbound message' },
|
||||
from_number: { type: 'string', description: 'Sending phone number' },
|
||||
number: { type: 'string', description: 'Recipient phone number', optional: true },
|
||||
media_url: { type: 'string', description: 'URL of attached media', optional: true },
|
||||
send_style: {
|
||||
type: 'string',
|
||||
description: 'iMessage expressive style applied',
|
||||
optional: true,
|
||||
},
|
||||
seat_id: {
|
||||
type: 'string',
|
||||
description: 'UUID of the seat that sent the message',
|
||||
optional: true,
|
||||
},
|
||||
sender_email: {
|
||||
type: 'string',
|
||||
description: 'Email of the seat (user) that sent the message',
|
||||
optional: true,
|
||||
},
|
||||
error_code: {
|
||||
type: 'number',
|
||||
description: 'Numeric error code if the message failed',
|
||||
optional: true,
|
||||
},
|
||||
error_message: {
|
||||
type: 'string',
|
||||
description: 'Error message if the message failed',
|
||||
optional: true,
|
||||
},
|
||||
date_created: { type: 'string', description: 'When the message was created', optional: true },
|
||||
date_updated: {
|
||||
type: 'string',
|
||||
description: 'When the message was last updated',
|
||||
optional: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
import { filterUndefined } from '@sim/utils/object'
|
||||
import type { SendblueSendMessageParams, SendblueSendMessageResponse } from '@/tools/sendblue/types'
|
||||
import {
|
||||
SENDBLUE_API_BASE_URL,
|
||||
sendblueBaseParamFields,
|
||||
sendblueHeaders,
|
||||
} from '@/tools/sendblue/utils'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const sendblueSendMessageTool: ToolConfig<
|
||||
SendblueSendMessageParams,
|
||||
SendblueSendMessageResponse
|
||||
> = {
|
||||
id: 'sendblue_send_message',
|
||||
name: 'Sendblue Send Message',
|
||||
description: 'Send an iMessage or SMS to a single recipient via Sendblue.',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
...sendblueBaseParamFields,
|
||||
number: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Recipient phone number in E.164 format (e.g., +19998887777)',
|
||||
},
|
||||
from_number: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'One of your registered Sendblue phone numbers to send from, in E.164 format (e.g., +18887776666)',
|
||||
},
|
||||
content: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Message text content. Either content or media_url must be provided.',
|
||||
},
|
||||
media_url: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'URL of a media file to send. Either content or media_url must be provided.',
|
||||
},
|
||||
send_style: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'iMessage expressive style (e.g., celebration, fireworks, lasers, confetti, balloons, invisible, slam).',
|
||||
},
|
||||
seat_id: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Seat (user) the message is attributed to. Accepts the seat UUID or Firebase Auth subject.',
|
||||
},
|
||||
status_callback: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
description: 'Webhook URL that Sendblue will POST message status updates to.',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: `${SENDBLUE_API_BASE_URL}/api/send-message`,
|
||||
method: 'POST',
|
||||
headers: (params) => sendblueHeaders(params),
|
||||
body: (params) =>
|
||||
filterUndefined({
|
||||
number: params.number,
|
||||
from_number: params.from_number,
|
||||
content: params.content,
|
||||
media_url: params.media_url,
|
||||
send_style: params.send_style,
|
||||
seat_id: params.seat_id,
|
||||
status_callback: params.status_callback,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
status: data.status ?? null,
|
||||
message_handle: data.message_handle ?? null,
|
||||
account_email: data.account_email ?? data.accountEmail ?? null,
|
||||
content: data.content ?? null,
|
||||
is_outbound: data.is_outbound ?? null,
|
||||
from_number: data.from_number ?? null,
|
||||
number: data.number ?? null,
|
||||
media_url: data.media_url ?? null,
|
||||
send_style: data.send_style ?? null,
|
||||
seat_id: data.seat_id ?? null,
|
||||
sender_email: data.sender_email ?? null,
|
||||
error_code: data.error_code ?? null,
|
||||
error_message: data.error_message ?? null,
|
||||
date_created: data.date_created ?? null,
|
||||
date_updated: data.date_updated ?? null,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
status: { type: 'string', description: 'Message status: QUEUED, SENT, DELIVERED, or ERROR' },
|
||||
message_handle: { type: 'string', description: 'Unique identifier for tracking the message' },
|
||||
account_email: { type: 'string', description: 'Email of the account that sent the message' },
|
||||
content: { type: 'string', description: 'Message content', optional: true },
|
||||
is_outbound: { type: 'boolean', description: 'Whether this is an outbound message' },
|
||||
from_number: { type: 'string', description: 'Sending phone number' },
|
||||
number: { type: 'string', description: 'Recipient phone number' },
|
||||
media_url: { type: 'string', description: 'URL of attached media', optional: true },
|
||||
send_style: {
|
||||
type: 'string',
|
||||
description: 'iMessage expressive style applied',
|
||||
optional: true,
|
||||
},
|
||||
seat_id: {
|
||||
type: 'string',
|
||||
description: 'UUID of the seat that sent the message',
|
||||
optional: true,
|
||||
},
|
||||
sender_email: {
|
||||
type: 'string',
|
||||
description: 'Email of the seat (user) that sent the message',
|
||||
optional: true,
|
||||
},
|
||||
error_code: {
|
||||
type: 'number',
|
||||
description: 'Numeric error code if the message failed',
|
||||
optional: true,
|
||||
},
|
||||
error_message: {
|
||||
type: 'string',
|
||||
description: 'Error message if the message failed',
|
||||
optional: true,
|
||||
},
|
||||
date_created: { type: 'string', description: 'When the message was created', optional: true },
|
||||
date_updated: {
|
||||
type: 'string',
|
||||
description: 'When the message was last updated',
|
||||
optional: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
import { filterUndefined } from '@sim/utils/object'
|
||||
import type {
|
||||
SendblueTypingIndicatorParams,
|
||||
SendblueTypingIndicatorResponse,
|
||||
} from '@/tools/sendblue/types'
|
||||
import {
|
||||
SENDBLUE_API_BASE_URL,
|
||||
sendblueBaseParamFields,
|
||||
sendblueHeaders,
|
||||
} from '@/tools/sendblue/utils'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const sendblueSendTypingIndicatorTool: ToolConfig<
|
||||
SendblueTypingIndicatorParams,
|
||||
SendblueTypingIndicatorResponse
|
||||
> = {
|
||||
id: 'sendblue_send_typing_indicator',
|
||||
name: 'Sendblue Send Typing Indicator',
|
||||
description: 'Display a typing indicator to a recipient (not supported in group chats).',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
...sendblueBaseParamFields,
|
||||
number: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: "Recipient's phone number in E.164 format (e.g., +19998887777)",
|
||||
},
|
||||
from_number: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Your Sendblue line number to send from, in E.164 format.',
|
||||
},
|
||||
state: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'"start" (default) shows the indicator; "stop" ends an active indicator before max_duration_ms expires.',
|
||||
},
|
||||
max_duration_ms: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'How long (ms) the indicator stays visible before auto-stopping. Defaults to 60000. Must be between 1 and 300000.',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: `${SENDBLUE_API_BASE_URL}/api/send-typing-indicator`,
|
||||
method: 'POST',
|
||||
headers: (params) => sendblueHeaders(params),
|
||||
body: (params) => {
|
||||
if (params.state !== undefined && params.state !== 'start' && params.state !== 'stop') {
|
||||
throw new Error('"state" must be either "start" or "stop".')
|
||||
}
|
||||
let maxDurationMs: number | undefined
|
||||
if (params.max_duration_ms !== undefined) {
|
||||
maxDurationMs = Number(params.max_duration_ms)
|
||||
if (!Number.isInteger(maxDurationMs) || maxDurationMs < 1 || maxDurationMs > 300000) {
|
||||
throw new Error('"max_duration_ms" must be an integer between 1 and 300000.')
|
||||
}
|
||||
}
|
||||
return filterUndefined({
|
||||
number: params.number,
|
||||
from_number: params.from_number,
|
||||
state: params.state,
|
||||
max_duration_ms: maxDurationMs,
|
||||
})
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
status: data.status ?? null,
|
||||
status_code: data.status_code ?? null,
|
||||
number: data.number ?? null,
|
||||
error_message: data.error_message ?? null,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
status: {
|
||||
type: 'string',
|
||||
description: 'Delivery status of the typing indicator (e.g., QUEUED)',
|
||||
},
|
||||
status_code: { type: 'number', description: 'Numeric status code returned by Sendblue' },
|
||||
number: { type: 'string', description: 'The recipient phone number' },
|
||||
error_message: {
|
||||
type: 'string',
|
||||
description: 'Error details, null on success',
|
||||
optional: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
import type { ToolResponse } from '@/tools/types'
|
||||
|
||||
/**
|
||||
* iMessage expressive styles supported by Sendblue.
|
||||
*/
|
||||
export type SendblueSendStyle =
|
||||
| 'celebration'
|
||||
| 'shooting_star'
|
||||
| 'fireworks'
|
||||
| 'lasers'
|
||||
| 'love'
|
||||
| 'confetti'
|
||||
| 'balloons'
|
||||
| 'spotlight'
|
||||
| 'echo'
|
||||
| 'invisible'
|
||||
| 'gentle'
|
||||
| 'loud'
|
||||
| 'slam'
|
||||
|
||||
export interface SendblueBaseParams {
|
||||
apiKeyId: string
|
||||
apiSecretKey: string
|
||||
}
|
||||
|
||||
export interface SendblueSendMessageParams extends SendblueBaseParams {
|
||||
number: string
|
||||
from_number: string
|
||||
content?: string
|
||||
media_url?: string
|
||||
send_style?: SendblueSendStyle
|
||||
seat_id?: string
|
||||
status_callback?: string
|
||||
}
|
||||
|
||||
export interface SendblueSendGroupMessageParams extends SendblueBaseParams {
|
||||
numbers?: string[]
|
||||
from_number: string
|
||||
content?: string
|
||||
media_url?: string
|
||||
send_style?: SendblueSendStyle
|
||||
seat_id?: string
|
||||
group_id?: string
|
||||
status_callback?: string
|
||||
}
|
||||
|
||||
export interface SendblueEvaluateServiceParams extends SendblueBaseParams {
|
||||
number: string
|
||||
}
|
||||
|
||||
export interface SendblueTypingIndicatorParams extends SendblueBaseParams {
|
||||
number: string
|
||||
from_number?: string
|
||||
state?: 'start' | 'stop'
|
||||
max_duration_ms?: number
|
||||
}
|
||||
|
||||
export interface SendblueGetMessageParams extends SendblueBaseParams {
|
||||
message_id: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Shared shape of a Sendblue message resource returned by the send endpoints.
|
||||
*/
|
||||
export interface SendblueMessageOutput {
|
||||
status: string | null
|
||||
message_handle: string | null
|
||||
account_email: string | null
|
||||
content: string | null
|
||||
is_outbound: boolean | null
|
||||
from_number: string | null
|
||||
number: string | null
|
||||
media_url: string | null
|
||||
send_style: string | null
|
||||
seat_id: string | null
|
||||
sender_email: string | null
|
||||
error_code: number | null
|
||||
error_message: string | null
|
||||
date_created: string | null
|
||||
date_updated: string | null
|
||||
}
|
||||
|
||||
export interface SendblueSendMessageResponse extends ToolResponse {
|
||||
output: SendblueMessageOutput
|
||||
}
|
||||
|
||||
export interface SendblueSendGroupMessageResponse extends ToolResponse {
|
||||
output: SendblueMessageOutput & {
|
||||
group_id: string | null
|
||||
participants: string[]
|
||||
}
|
||||
}
|
||||
|
||||
export interface SendblueEvaluateServiceResponse extends ToolResponse {
|
||||
output: {
|
||||
number: string | null
|
||||
service: string | null
|
||||
}
|
||||
}
|
||||
|
||||
export interface SendblueTypingIndicatorResponse extends ToolResponse {
|
||||
output: {
|
||||
status: string | null
|
||||
status_code: number | null
|
||||
number: string | null
|
||||
error_message: string | null
|
||||
}
|
||||
}
|
||||
|
||||
export interface SendblueGetMessageResponse extends ToolResponse {
|
||||
output: {
|
||||
status: string | null
|
||||
message_handle: string | null
|
||||
account_email: string | null
|
||||
content: string | null
|
||||
is_outbound: boolean | null
|
||||
from_number: string | null
|
||||
number: string | null
|
||||
to_number: string | null
|
||||
media_url: string | null
|
||||
message_type: string | null
|
||||
service: string | null
|
||||
group_id: string | null
|
||||
group_display_name: string | null
|
||||
participants: string[]
|
||||
send_style: string | null
|
||||
was_downgraded: boolean | null
|
||||
opted_out: boolean | null
|
||||
plan: string | null
|
||||
sendblue_number: string | null
|
||||
seat_id: string | null
|
||||
sender_email: string | null
|
||||
error_code: number | null
|
||||
error_message: string | null
|
||||
error_reason: string | null
|
||||
error_detail: string | null
|
||||
date_sent: string | null
|
||||
date_updated: string | null
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
import type { SendblueBaseParams } from '@/tools/sendblue/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
/**
|
||||
* Base URL for the Sendblue API as documented at https://docs.sendblue.com/api-v2/.
|
||||
*/
|
||||
export const SENDBLUE_API_BASE_URL = 'https://api.sendblue.com'
|
||||
|
||||
/**
|
||||
* Builds the authentication headers required by every Sendblue endpoint.
|
||||
* Sendblue authenticates with an API Key ID and API Secret Key sent as
|
||||
* the `sb-api-key-id` and `sb-api-secret-key` headers.
|
||||
*/
|
||||
export function sendblueHeaders(params: SendblueBaseParams): Record<string, string> {
|
||||
return {
|
||||
'sb-api-key-id': params.apiKeyId.trim(),
|
||||
'sb-api-secret-key': params.apiSecretKey.trim(),
|
||||
'Content-Type': 'application/json',
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shared credential param definitions reused across all Sendblue tools.
|
||||
*/
|
||||
export const sendblueBaseParamFields = {
|
||||
apiKeyId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Sendblue API Key ID (sb-api-key-id)',
|
||||
},
|
||||
apiSecretKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Sendblue API Secret Key (sb-api-secret-key)',
|
||||
},
|
||||
} satisfies ToolConfig['params']
|
||||
Reference in New Issue
Block a user