From c0291d5ad64dc3ee5a307461a05ab741087aa4d2 Mon Sep 17 00:00:00 2001 From: Quantstruct Bot Date: Thu, 22 May 2025 12:16:33 -0700 Subject: [PATCH] docs: add getting started guide for sending your first SMS with a1base --- getting-started-sms.md | 89 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 getting-started-sms.md diff --git a/getting-started-sms.md b/getting-started-sms.md new file mode 100644 index 0000000..b37d3a6 --- /dev/null +++ b/getting-started-sms.md @@ -0,0 +1,89 @@ +# Getting Started: Sending Your First SMS with a1base + +This guide will help you send your first SMS using the a1base API. Code samples are provided for both Python and TypeScript. 🚀 + +--- + +## Prerequisites +- Your a1base account ID +- API key and API secret +- Sender and recipient phone numbers +- Python 3 or Node.js (for TypeScript) + +--- + +## 1. Endpoint Information +- **URL:** `POST /v1/messages/sms/{accountId}/send` +- **Headers:** + - `x-api-key`: Your API key + - `x-api-secret`: Your API secret +- **Body:** + - `content`: Message body text + - `from`: Sender phone number + - `to`: Recipient phone number + - `service`: `sms` + +--- + +## 2. Python Example +```python +import requests + +account_id = "YOUR_ACCOUNT_ID" +url = f"https://api.a1base.com/v1/messages/sms/{account_id}/send" +headers = { + "x-api-key": "YOUR_API_KEY", + "x-api-secret": "YOUR_API_SECRET", + "Content-Type": "application/json" +} +data = { + "content": "Hello from a1base! 🚀", + "from": "SENDER_PHONE_NUMBER", + "to": "RECIPIENT_PHONE_NUMBER", + "service": "sms" +} + +response = requests.post(url, json=data, headers=headers) +print(response.json()) +``` + +--- + +## 3. TypeScript Example +```typescript +import axios from 'axios'; + +const accountId = 'YOUR_ACCOUNT_ID'; +const url = `https://api.a1base.com/v1/messages/sms/${accountId}/send`; +const headers = { + 'x-api-key': 'YOUR_API_KEY', + 'x-api-secret': 'YOUR_API_SECRET', + 'Content-Type': 'application/json', +}; +const data = { + content: 'Hello from a1base! 🚀', + from: 'SENDER_PHONE_NUMBER', + to: 'RECIPIENT_PHONE_NUMBER', + service: 'sms', +}; + +axios.post(url, data, { headers }) + .then(response => console.log(response.data)) + .catch(error => console.error(error)); +``` + +--- + +## 4. Response Example +```json +{ + "to": "61433174782", + "from": "61421868490", + "body": "Hello from a1base! 🚀", + "status": "queued" +} +``` + +--- + +You're all set to send your first SMS with a1base! 🎉📱 \ No newline at end of file