d25d482dc2
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) Has been cancelled
Publish Python SDK / publish-pypi (push) Has been cancelled
Publish TypeScript SDK / publish-npm (push) Has been cancelled
79 lines
2.2 KiB
TypeScript
79 lines
2.2 KiB
TypeScript
import type { ToolConfig } from '@/tools/types'
|
|
import type { WhatsAppSendReactionParams, WhatsAppSendResponse } from '@/tools/whatsapp/types'
|
|
import {
|
|
buildAuthHeaders,
|
|
buildMessagesUrl,
|
|
transformWhatsAppSendResponse,
|
|
whatsappSendOutputs,
|
|
} from '@/tools/whatsapp/utils'
|
|
|
|
export const sendReactionTool: ToolConfig<WhatsAppSendReactionParams, WhatsAppSendResponse> = {
|
|
id: 'whatsapp_send_reaction',
|
|
name: 'WhatsApp Send Reaction',
|
|
description:
|
|
'React to a WhatsApp message with an emoji. Send an empty emoji to remove an existing reaction.',
|
|
version: '1.0.0',
|
|
|
|
params: {
|
|
phoneNumber: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-or-llm',
|
|
description: 'Recipient phone number with country code (e.g., +14155552671)',
|
|
},
|
|
messageId: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-or-llm',
|
|
description: 'ID (wamid) of the message to react to',
|
|
},
|
|
emoji: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Emoji to react with. Leave empty to remove an existing reaction.',
|
|
},
|
|
phoneNumberId: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-only',
|
|
description: 'WhatsApp Business Phone Number ID (from Meta Business Suite)',
|
|
},
|
|
accessToken: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-only',
|
|
description: 'WhatsApp Business API Access Token (from Meta Developer Portal)',
|
|
},
|
|
},
|
|
|
|
request: {
|
|
url: (params) => buildMessagesUrl(params.phoneNumberId),
|
|
method: 'POST',
|
|
headers: (params) => buildAuthHeaders(params.accessToken),
|
|
body: (params) => {
|
|
if (!params.phoneNumber) {
|
|
throw new Error('Phone number is required but was not provided')
|
|
}
|
|
if (!params.messageId) {
|
|
throw new Error('Message ID is required but was not provided')
|
|
}
|
|
|
|
return {
|
|
messaging_product: 'whatsapp',
|
|
recipient_type: 'individual',
|
|
to: params.phoneNumber.trim(),
|
|
type: 'reaction',
|
|
reaction: {
|
|
message_id: params.messageId.trim(),
|
|
emoji: params.emoji ?? '',
|
|
},
|
|
}
|
|
},
|
|
},
|
|
|
|
transformResponse: transformWhatsAppSendResponse,
|
|
|
|
outputs: whatsappSendOutputs,
|
|
}
|