SDK Libraries
Official client libraries for integrating Aimstors Solution into your applications.
Installation
Terminal
npm install @aimstors/sdkQuick Start
Initialize the client
const Aimstors Solution = require('@aimstors/sdk');
const client = new Aimstors Solution({
apiKey: process.env.AIMSTORS_API_KEY
});Send a Message
Send template message
// Send a template message
const response = await client.messages.send({
to: '+919876543210',
template: 'order_confirmation',
language: 'en',
variables: ['John', 'ORD-12345', '₹1,499']
});
console.log('Message ID:', response.id);
console.log('Status:', response.status);Webhook Handler
Handle webhook events
// Handle webhook events
app.post('/webhook', express.json(), (req, res) => {
const event = req.body;
switch (event.event) {
case 'message.received':
console.log('New message from:', event.data.from);
break;
case 'message.delivered':
console.log('Message delivered:', event.data.id);
break;
}
res.status(200).json({ received: true });
});