Unofficial Node.js SDK for Ayyıldız Mobile SMS API.
pnpm add @muhammedaksam/ayyildiz-nodenpm install @muhammedaksam/ayyildiz-nodeyarn add @muhammedaksam/ayyildiz-nodeimport { AyyildizClient } from '@muhammedaksam/ayyildiz-node';
const client = new AyyildizClient({
username: 'your-username',
password: 'your-password',
companyCode: 'your-company-code',
defaultOriginator: 'SENDER' // optional
});
// Send SMS
const response = await client.sms().send({
to: '+905551234567',
message: 'Hello from Ayyıldız Mobile!'
});
console.log(response.success);// Option 1: Using config object
const client = new AyyildizClient({
username: 'your-username',
password: 'your-password',
companyCode: 'your-company-code',
defaultOriginator: 'SENDER' // optional
});
// Option 2: Using parameters
const client = new AyyildizClient(
'your-username',
'your-password',
'your-company-code',
'SENDER' // optional
);// Send single SMS
await client.sms().send('+905551234567', 'Your message');
// Send SMS with custom originator
await client.sms().send('+905551234567', 'Your message', 'CUSTOM');
// Send SMS to multiple recipients
await client.sms().send(['+905551234567', '+905557654321'], 'Your message');
// Send different messages to different recipients
await client.sms().send({
'+905551234567': 'Message for first recipient',
'+905557654321': 'Message for second recipient'
});// Send SMS using HTTP GET method
await client.sms().sendViaHttp('+905551234567', 'Your message', 'SENDER');// Schedule SMS for later delivery
await client
.sms()
.schedule('311220241430') // ddmmyyyyhhmm format
.send('+905551234567', 'Scheduled message');import { SmsType } from '@muhammedaksam/ayyildiz-node';
// Set SMS type before sending
await client
.sms()
.setType(SmsType.LONG) // 918 character SMS
.send('+905551234567', 'Long message');
// Available SMS types:
// SmsType.STANDARD = 160 character SMS
// SmsType.LONG = 918 character SMS
// SmsType.TURKISH_SHORT = 70 character Turkish SMS
// SmsType.TURKISH_LONG = 402 character Turkish SMS
// SmsType.TURKISH_STANDARD = 155/894 character Turkish SMS (default)
// SmsType.INTERNATIONAL = 402 character International SMSconst balance = await client.account().getCredit();
console.log(balance.data);// Get reports by date range
const reports = await client.reports().getByDateRange('20240101', '20240131');
// Get detailed report by message GUID
const detailedReport = await client.reports().getDetailedReport('message-guid');
// Get report by message ID
const report = await client.reports().getByMessageId('message-id');
// Get report in XML format
const xmlReport = await client.reports().getXmlReport('message-id');const originators = await client.senders().getOriginators();
console.log(originators.data);try {
const response = await client.sms().send('+905551234567', 'Hello!');
if (response.success) {
console.log('SMS sent successfully');
} else {
console.error('SMS failed:', response.error);
}
} catch (error) {
console.error('Request failed:', error);
}const client = new AyyildizClient(config);
// Send SMS
await client.sms().send({
to: '+905551234567',
message: 'Hello!'
});
// Get debug information
console.log(client.debug());The SDK automatically handles Turkish characters in SMS messages. You can send messages with Turkish characters like ğ, ü, ş, ı, ö, ç without any special configuration.
- Node.js (latest LTS version recommended)
- pnpm (latest version recommended as package manager)
# Install pnpm if not already installed
npm install -g pnpm
# Install dependencies (uses pnpm-lock.yaml)
pnpm install
# Build the project
pnpm run build
# Run tests
pnpm test
# Lint code
pnpm run lint
# Format code
pnpm run formatThis project uses pnpm as the preferred package manager for several advantages:
- Faster installations: pnpm reuses packages from a global store
- Disk space efficiency: No duplicate packages across projects
- Stricter dependency resolution: Better compatibility and security
- Monorepo support: Excellent for complex project structures
- Lockfile optimization: More reliable dependency resolution
# Install dependencies
pnpm install
# Add a dependency
pnpm add package-name
# Add a dev dependency
pnpm add -D package-name
# Remove a dependency
pnpm remove package-name
# Update dependencies
pnpm update
# Check outdated packages
pnpm outdatedpnpm run buildThis will compile TypeScript to JavaScript in the dist directory.
This project uses pnpm as the preferred package manager. While you can use npm or yarn, pnpm is recommended for:
- Faster installation
- Better disk space efficiency
- Stricter dependency resolution
- Better monorepo support
This SDK is written in TypeScript and provides full type definitions. No
additional @types packages are needed.
For detailed API documentation, please visit Ayyıldız Mobile API Documentation.
For support and questions:
- GitHub Issues: https://github.com/muhammedaksam/ayyildiz-node/issues
This project is licensed under the MIT License - see the LICENSE.md file for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
See CHANGELOG.md for details about changes in each version.