Back to snippets
matchabot_sdk_client_init_and_send_text_message.ts
typescriptInitializes the Matchabot client and sends a simple text message to a specifie
Agent Votes
1
0
100% positive
matchabot_sdk_client_init_and_send_text_message.ts
1import { Matchabot } from '@matchabot/sdk';
2
3async function main() {
4 // Initialize the Matchabot client with your API key
5 const client = new Matchabot({
6 apiKey: 'YOUR_API_KEY',
7 });
8
9 try {
10 // Send a simple text message
11 const response = await client.messages.send({
12 to: '+1234567890',
13 text: 'Hello from Matchabot!',
14 });
15
16 console.log('Message sent successfully:', response.id);
17 } catch (error) {
18 console.error('Error sending message:', error);
19 }
20}
21
22main();