{
	"info": {
		"_postman_id": "sms-api-collection",
		"name": "MultiChannel API - SMS",
		"description": "Complete SMS API collection for template management, sending messages, and retrieving delivery reports.",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
		"_exporter_id": "multichannel-sms-api"
	},
	"item": [
		{
			"name": "Create SMS Template",
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Authorization",
						"value": "Bearer {{api_token}}",
						"type": "text"
					},
					{
						"key": "Content-Type",
						"value": "application/json",
						"type": "text"
					}
				],
				"body": {
					"mode": "raw",
					"raw": "{\n  \"template_name\": \"otp_alert\",\n  \"entity_id\": \"1234567890\",\n  \"dlt_template_id\": \"DLT12345\",\n  \"content\": \"Hello {name}, your One Time Password (OTP) is {otp}. Please use this code to complete your verification.\",\n  \"sender_id\": \"ABCDEF\"\n}",
					"options": {
						"raw": {
							"language": "json"
						}
					}
				},
				"url": {
					"raw": "{{base_url}}/api/v1/sms/storeTemplate",
					"host": ["{{base_url}}"],
					"path": ["api", "v1", "sms", "storeTemplate"]
				},
				"description": "Creates a new SMS template. Templates must be approved before use. Supports placeholders like {name}, {otp} for personalization.\n\n**Required Fields:**\n- `template_name`: Unique name for the template\n- `entity_id`: DLT entity ID\n- `dlt_template_id`: DLT template ID\n- `content`: Message content with placeholders\n- `sender_id`: Registered sender ID (must exist in system)\n\n**Response includes:**\n- `template_id`: Use this ID when sending messages\n- `char_count`: Character count\n- `sms_units`: Number of SMS segments\n- `template_status`: Approval status"
			},
			"response": [
				{
					"name": "Success Response",
					"originalRequest": {
						"method": "POST",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{api_token}}"
							},
							{
								"key": "Content-Type",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"template_name\": \"otp_alert\",\n  \"entity_id\": \"1234567890\",\n  \"dlt_template_id\": \"DLT12345\",\n  \"content\": \"Hello {name}, your OTP is {otp}.\",\n  \"sender_id\": \"ABCDEF\"\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{base_url}}/api/v1/sms/storeTemplate",
							"host": ["{{base_url}}"],
							"path": ["api", "v1", "sms", "storeTemplate"]
						}
					},
					"status": "Created",
					"code": 201,
					"_postman_previewlanguage": "json",
					"header": [
						{
							"key": "Content-Type",
							"value": "application/json"
						}
					],
					"body": "{\n  \"success\": true,\n  \"message\": \"Template created successfully.\",\n  \"template_id\": 158,\n  \"char_count\": 154,\n  \"sms_units\": 1,\n  \"template_status\": \"Pending for approval\"\n}"
				},
				{
					"name": "Validation Error",
					"originalRequest": {
						"method": "POST",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"template_name\": \"\"\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{base_url}}/api/v1/sms/storeTemplate",
							"host": ["{{base_url}}"],
							"path": ["api", "v1", "sms", "storeTemplate"]
						}
					},
					"status": "Unprocessable Entity",
					"code": 422,
					"_postman_previewlanguage": "json",
					"body": "{\n  \"success\": false,\n  \"message\": \"The given data was invalid.\",\n  \"errors\": {\n    \"template_name\": [\"The template name field is required.\"],\n    \"entity_id\": [\"The entity id field is required.\"],\n    \"content\": [\"The content field is required.\"],\n    \"sender_id\": [\"The sender id field is required.\"]\n  }\n}"
				}
			]
		},
		{
			"name": "Get SMS Templates",
			"item": [
				{
					"name": "Get All Templates",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{api_token}}",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/api/v1/sms/templates",
							"host": ["{{base_url}}"],
							"path": ["api", "v1", "sms", "templates"]
						},
						"description": "Retrieves all SMS templates for the authenticated user. Returns a list of templates with their details including status, content, character count, and SMS units."
					},
					"response": [
						{
							"name": "Success Response",
							"originalRequest": {
								"method": "GET",
								"header": [
									{
										"key": "Authorization",
										"value": "Bearer {{api_token}}"
									}
								],
								"url": {
									"raw": "{{base_url}}/api/v1/sms/templates",
									"host": ["{{base_url}}"],
									"path": ["api", "v1", "sms", "templates"]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"body": "{\n  \"success\": true,\n  \"data\": [\n    {\n      \"template_id\": 158,\n      \"template_name\": \"otp_alert\",\n      \"entity_id\": \"1234567890\",\n      \"dlt_template_id\": \"DLT12345\",\n      \"sender_id\": \"ABCDEF\",\n      \"status\": \"Approved\",\n      \"content\": \"Hello {name}, your OTP is {otp}.\",\n      \"char_count\": 154,\n      \"sms_units\": 1,\n      \"encoding\": \"GSM-7\",\n      \"cost\": 0.25,\n      \"has_url\": false,\n      \"created_at\": \"2025-12-24 12:30:45\",\n      \"updated_at\": \"2025-12-24 12:30:45\"\n    }\n  ]\n}"
						}
					]
				},
				{
					"name": "Get Single Template",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{api_token}}",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/api/v1/sms/templates/:id",
							"host": ["{{base_url}}"],
							"path": ["api", "v1", "sms", "templates", ":id"],
							"variable": [
								{
									"key": "id",
									"value": "158",
									"description": "Template ID for SMS template"
								}
							]
						},
						"description": "Retrieves a specific SMS template by ID. Returns detailed information about the template including content, status, and metadata."
					},
					"response": [
						{
							"name": "Success Response",
							"originalRequest": {
								"method": "GET",
								"header": [
									{
										"key": "Authorization",
										"value": "Bearer {{api_token}}"
									}
								],
								"url": {
									"raw": "{{base_url}}/api/v1/sms/templates/:id",
									"host": ["{{base_url}}"],
									"path": ["api", "v1", "sms", "templates", ":id"]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"body": "{\n  \"success\": true,\n  \"data\": {\n    \"template_id\": 158,\n    \"template_name\": \"otp_alert\",\n    \"entity_id\": \"1234567890\",\n    \"dlt_template_id\": \"DLT12345\",\n    \"sender_id\": \"ABCDEF\",\n    \"status\": \"Approved\",\n    \"content\": \"Hello {name}, your OTP is {otp}.\",\n    \"char_count\": 154,\n    \"sms_units\": 1,\n    \"encoding\": \"GSM-7\",\n    \"cost\": 0.25,\n    \"has_url\": false,\n    \"created_at\": \"2025-12-24 12:30:45\",\n    \"updated_at\": \"2025-12-24 12:30:45\"\n  }\n}"
						},
						{
							"name": "Not Found",
							"originalRequest": {
								"method": "GET",
								"header": [],
								"url": {
									"raw": "{{base_url}}/api/v1/sms/templates/999",
									"host": ["{{base_url}}"],
									"path": ["api", "v1", "sms", "templates", "999"]
								}
							},
							"status": "Not Found",
							"code": 404,
							"_postman_previewlanguage": "json",
							"body": "{\n  \"success\": false,\n  \"message\": \"Template not available for this user or does not exist.\"\n}"
						}
					]
				}
			]
		},
		{
			"name": "Send SMS Message",
			"item": [
				{
					"name": "Non-Personalized (Bulk Send)",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{api_token}}",
								"type": "text"
							},
							{
								"key": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"template_id\": 158,\n  \"unicode\": 0,\n  \"personalized\": 0,\n  \"numbers\": [\"9876543210\", \"9123456780\"]\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{base_url}}/api/v1/sms/sendMessage",
							"host": ["{{base_url}}"],
							"path": ["api", "v1", "sms", "sendMessage"]
						},
						"description": "Sends SMS messages to multiple recipients using a template. Same message is sent to all recipients.\n\n**Parameters:**\n- `template_id`: ID of approved SMS template (recommended)\n- OR `senderid` + `message`: Raw mode (alternative)\n- `unicode`: 0 = English, 1 = Unicode (multi-language)\n- `personalized`: 0 = Non-personalized (bulk)\n- `numbers`: Array of 10-digit phone numbers (max 300)\n\n**Note:** Each message is stored individually in `sms_logs` with per-message `cost`, `message_content`, `sms_units`, and `message_length`."
					},
					"response": [
						{
							"name": "Success Response",
							"originalRequest": {
								"method": "POST",
								"header": [
									{
										"key": "Authorization",
										"value": "Bearer {{api_token}}"
									},
									{
										"key": "Content-Type",
										"value": "application/json"
									}
								],
								"body": {
									"mode": "raw",
									"raw": "{\n  \"template_id\": 158,\n  \"unicode\": 0,\n  \"personalized\": 0,\n  \"numbers\": [\"9876543210\", \"9123456780\"]\n}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "{{base_url}}/api/v1/sms/sendMessage",
									"host": ["{{base_url}}"],
									"path": ["api", "v1", "sms", "sendMessage"]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"body": "{\n  \"success\": true,\n  \"message\": \"Message submitted successfully.\",\n  \"reference_id\": \"INSIGNTEST-251224132336-OTA5NDA=\"\n}"
						},
						{
							"name": "Gateway Error",
							"originalRequest": {
								"method": "POST",
								"header": [],
								"body": {
									"mode": "raw",
									"raw": "{\n  \"template_id\": 999,\n  \"unicode\": 0,\n  \"personalized\": 0,\n  \"numbers\": [\"9876543210\"]\n}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "{{base_url}}/api/v1/sms/sendMessage",
									"host": ["{{base_url}}"],
									"path": ["api", "v1", "sms", "sendMessage"]
								}
							},
							"status": "Bad Request",
							"code": 400,
							"_postman_previewlanguage": "json",
							"body": "{\n  \"success\": false,\n  \"code\": \"ERROR_CODE\",\n  \"message\": \"Invalid sender ID or gateway error message.\"\n}"
						}
					]
				},
				{
					"name": "Personalized (Custom per Recipient)",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{api_token}}",
								"type": "text"
							},
							{
								"key": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"template_id\": 158,\n  \"unicode\": 0,\n  \"personalized\": 1,\n  \"numbers\": [\n    {\"number\": \"9876543210\", \"name\": \"Sanjay\", \"otp\": \"123456\"},\n    {\"number\": \"9123456780\", \"name\": \"Amit\", \"otp\": \"654321\"}\n  ]\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{base_url}}/api/v1/sms/sendMessage",
							"host": ["{{base_url}}"],
							"path": ["api", "v1", "sms", "sendMessage"]
						},
						"description": "Sends personalized SMS messages where each recipient receives a customized message with their own data.\n\n**Parameters:**\n- `template_id`: ID of approved SMS template\n- `unicode`: 0 = English, 1 = Unicode\n- `personalized`: 1 = Personalized mode\n- `numbers`: Array of objects with `number` (10-digit) and dynamic fields matching template variables (max 100 recipients)\n\n**Example:** If template has {name} and {otp}, provide: `{\"number\": \"9876543210\", \"name\": \"John\", \"otp\": \"123456\"}`"
					},
					"response": [
						{
							"name": "Success Response",
							"originalRequest": {
								"method": "POST",
								"header": [
									{
										"key": "Authorization",
										"value": "Bearer {{api_token}}"
									},
									{
										"key": "Content-Type",
										"value": "application/json"
									}
								],
								"body": {
									"mode": "raw",
									"raw": "{\n  \"template_id\": 158,\n  \"unicode\": 0,\n  \"personalized\": 1,\n  \"numbers\": [\n    {\"number\": \"9876543210\", \"name\": \"Sanjay\", \"otp\": \"123456\"}\n  ]\n}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "{{base_url}}/api/v1/sms/sendMessage",
									"host": ["{{base_url}}"],
									"path": ["api", "v1", "sms", "sendMessage"]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"body": "{\n  \"success\": true,\n  \"message\": \"Personalized messages submitted.\",\n  \"reference_id\": \"INSIGNTEST-251224132336-OTA5NDA=\"\n}"
						}
					]
				},
				{
					"name": "Raw Mode (Without Template)",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{api_token}}",
								"type": "text"
							},
							{
								"key": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"senderid\": \"ABCDEF\",\n  \"message\": \"Hello {name}, your OTP is {otp}.\",\n  \"unicode\": 0,\n  \"personalized\": 1,\n  \"numbers\": [\n    {\"number\": \"9876543210\", \"name\": \"Sanjay\", \"otp\": \"123456\"}\n  ]\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{base_url}}/api/v1/sms/sendMessage",
							"host": ["{{base_url}}"],
							"path": ["api", "v1", "sms", "sendMessage"]
						},
						"description": "Sends SMS using raw `senderid` and `message` fields instead of a template. Use this when you don't have a pre-approved template.\n\n**Required when not using template_id:**\n- `senderid`: Registered sender ID (max 6 characters)\n- `message`: Message text with placeholders\n\n**Note:** Placeholders in message should match the fields provided in `numbers` array for personalized mode."
					},
					"response": [
						{
							"name": "Success Response",
							"originalRequest": {
								"method": "POST",
								"header": [],
								"body": {
									"mode": "raw",
									"raw": "{\n  \"senderid\": \"ABCDEF\",\n  \"message\": \"Hello {name}, your OTP is {otp}.\",\n  \"unicode\": 0,\n  \"personalized\": 1,\n  \"numbers\": [\n    {\"number\": \"9876543210\", \"name\": \"Sanjay\", \"otp\": \"123456\"}\n  ]\n}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "{{base_url}}/api/v1/sms/sendMessage",
									"host": ["{{base_url}}"],
									"path": ["api", "v1", "sms", "sendMessage"]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"body": "{\n  \"success\": true,\n  \"message\": \"Message submitted successfully.\",\n  \"reference_id\": \"INSIGNTEST-251224132336-OTA5NDA=\"\n}"
						}
					]
				}
			]
		},
		{
			"name": "Get SMS Report",
			"request": {
				"method": "GET",
				"header": [
					{
						"key": "Authorization",
						"value": "Bearer {{api_token}}",
						"type": "text"
					}
				],
				"url": {
					"raw": "{{base_url}}/api/v1/sms/reports/:gateway_ref_id",
					"host": ["{{base_url}}"],
					"path": ["api", "v1", "sms", "reports", ":gateway_ref_id"],
					"variable": [
						{
							"key": "gateway_ref_id",
							"value": "INSIGNTEST-251224132336-OTA5NDA=",
							"description": "The reference_id returned when sending SMS"
						}
					]
				},
				"description": "Retrieves the delivery report for a previously sent SMS batch. Use the `reference_id` (also known as `gateway_ref_id`) returned from the sendMessage endpoint.\n\n**Response includes:**\n- Individual message status for each recipient\n- Delivery timestamps\n- Per-message details stored in `sms_logs`\n\n**Note:** Each SMS message is stored individually with per-message `message_content`, `cost`, `sms_units`, and `message_length`."
			},
			"response": [
				{
					"name": "Success Response",
					"originalRequest": {
						"method": "GET",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{api_token}}"
							}
						],
						"url": {
							"raw": "{{base_url}}/api/v1/sms/reports/INSIGNTEST-251224132336-OTA5NDA=",
							"host": ["{{base_url}}"],
							"path": ["api", "v1", "sms", "reports", "INSIGNTEST-251224132336-OTA5NDA="]
						}
					},
					"status": "OK",
					"code": 200,
					"_postman_previewlanguage": "json",
					"body": "[\n  {\n    \"number\": \"9876543210\",\n    \"status\": \"submitted\",\n    \"timespan\": \"2025-12-24T13:23:36+00:00\"\n  },\n  {\n    \"number\": \"9123456780\",\n    \"status\": \"delivered\",\n    \"timespan\": \"2025-12-24T13:23:40+00:00\"\n  }\n]"
				},
				{
					"name": "Not Found",
					"originalRequest": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/v1/sms/reports/INVALID_REF_ID",
							"host": ["{{base_url}}"],
							"path": ["api", "v1", "sms", "reports", "INVALID_REF_ID"]
						}
					},
					"status": "Not Found",
					"code": 404,
					"_postman_previewlanguage": "json",
					"body": "{\n  \"success\": false,\n  \"message\": \"Report not found.\"\n}"
				}
			]
		}
	],
	"variable": [
		{
			"key": "base_url",
			"value": "https://example.com",
			"type": "string",
			"description": "Base URL for the API. Update this with your actual domain."
		},
		{
			"key": "api_token",
			"value": "YOUR_API_TOKEN_HERE",
			"type": "string",
			"description": "Your API authentication token. Get this from the developer dashboard after generating an API key."
		}
	],
	"auth": {
		"type": "bearer",
		"bearer": [
			{
				"key": "token",
				"value": "{{api_token}}",
				"type": "string"
			}
		]
	}
}

