Text
Copy
await client.messages.sendText({
phoneNumberId: '123',
to: '56961567267',
body: 'Hola desde Kapso!',
// Optional: disable URL previews
previewUrl: false
});
Location
Copy
await client.messages.sendLocation({
phoneNumberId: '123',
to: '56961567267',
location: {
latitude: -33.4489,
longitude: -70.6693,
name: 'Santiago',
address: 'CL'
}
});
Contacts
Copy
await client.messages.sendContacts({
phoneNumberId: '123',
to: '56961567267',
contacts: [
{
name: { formatted_name: 'Ada Lovelace' },
org: { company: 'Analytical Engines' },
phones: [{ phone: '+44123456789', type: 'WORK' }]
}
]
});
Reaction
Copy
await client.messages.sendReaction({
phoneNumberId: '123',
to: '56961567267',
reaction: { messageId: 'wamid.SOME_ID', emoji: '👍' }
});
Mark as read
Copy
await client.messages.markRead({
phoneNumberId: '123',
messageId: 'wamid.SOME_ID'
});
Message history
Copy
// Query by time and direction
const page = await client.messages.query({
phoneNumberId: '123',
direction: 'inbound',
since: '2025-01-01T00:00:00Z',
perPage: 50
});
// List messages for a single conversation
const convMessages = await client.messages.listByConversation({
phoneNumberId: '123',
conversationId: 'conv-123',
perPage: 25
});