### Send SMS using Verimor API in Java Source: https://github.com/verimor/sms-api/blob/master/sample_codes/README.md Provides Java code examples for sending SMS messages through the Verimor SMS API. This typically uses HTTP client libraries to interact with the API. ```java // Example Java code for sending SMS import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; public class SmsSender { public void sendSms(String apiKey, String message, String phoneNumber) throws Exception { String url = "https://api.verimor.net/v2/send.php"; String charset = "UTF-8"; String query = String.format("key=%s&message=%s&recipient=%s", URLEncoder.encode(apiKey, charset), URLEncoder.encode(message, charset), URLEncoder.encode(phoneNumber, charset)); HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(); connection.setRequestMethod("POST"); connection.setDoOutput(true); connection.setRequestProperty("Accept-Charset", charset); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded; charset=" + charset); try (OutputStream output = connection.getOutputStream()) { output.write(query.getBytes(charset)); } try (BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), charset))) { String line; while ((line = reader.readLine()) != null) { System.out.println(line); } } } } ``` -------------------------------- ### List SMS Headers (Sender IDs) via HTTP GET (Bash) Source: https://context7.com/verimor/sms-api/llms.txt Retrieves a list of all approved sender IDs (headers) associated with your Verimor account. Requires valid username and password. Returns an array of strings or an error message. ```bash curl "https://sms.verimor.com.tr/v2/headers?username=908501234567&password=YOUR_API_PASSWORD" # Response (HTTP 200): ["VERIMOR", "MYCOMPANY", "ALERTS"] # Response (HTTP 401 - Invalid credentials): Geçersiz kullanıcı adı/şifre ``` -------------------------------- ### Send Single SMS via HTTP GET Source: https://context7.com/verimor/sms-api/llms.txt Sends a single SMS message to one or multiple recipients using a URL-based GET request. This method is suitable for quick integrations and testing. Requires username, password, source address, message content, and destination phone numbers. ```bash # Send SMS to multiple recipients curl "https://sms.verimor.com.tr/v2/send?username=908501234567&password=YOUR_API_PASSWORD&source_addr=MYHEADER&msg=Hello%20World&dest=905311234567,905319876543&datacoding=0&valid_for=2:00" # Response (Success - HTTP 200): 20210 # Response (Failure - HTTP 400): INSUFFICIENT_CREDITS ``` -------------------------------- ### Query Account Balance via HTTP GET (PHP) Source: https://context7.com/verimor/sms-api/llms.txt Checks the remaining SMS credits for your Verimor account. Uses cURL to make the request and returns the balance as an integer or false on error. ```php ``` -------------------------------- ### Send SMS via HTTP GET Source: https://context7.com/verimor/sms-api/llms.txt Send a single SMS message to one or multiple recipients using a simple URL-based GET request. This method is ideal for quick integrations and testing. ```APIDOC ## GET /v2/send ### Description Send a single SMS message to one or multiple recipients using a simple URL-based GET request. ### Method GET ### Endpoint `https://sms.verimor.com.tr/v2/send` ### Parameters #### Query Parameters - **username** (string) - Required - Your Verimor account username (12-digit phone number). - **password** (string) - Required - Your Verimor API password. - **source_addr** (string) - Required - The sender ID (header) of the SMS. - **msg** (string) - Required - The content of the SMS message. URL-encoded. - **dest** (string) - Required - One or more recipient phone numbers, separated by commas. - **datacoding** (integer) - Optional - Data coding scheme (0 for plain text, 2 for Unicode). - **valid_for** (string) - Optional - Validity period for the message (e.g., "2:00" for 2 hours). ### Request Example ```bash curl "https://sms.verimor.com.tr/v2/send?username=908501234567&password=YOUR_API_PASSWORD&source_addr=MYHEADER&msg=Hello%20World&dest=905311234567,905319876543&datacoding=0&valid_for=2:00" ``` ### Response #### Success Response (200) - **campaign_id** (integer) - The ID of the sent campaign. #### Response Example ``` 20210 ``` #### Error Response (400) - **error_message** (string) - Description of the error (e.g., INSUFFICIENT_CREDITS). #### Response Example ``` INSUFFICIENT_CREDITS ``` ``` -------------------------------- ### Get Delivery Report via HTTP GET Source: https://context7.com/verimor/sms-api/llms.txt Query the delivery status of sent messages by campaign ID, custom ID, or specific phone numbers. This endpoint allows you to track the delivery status of your SMS messages. ```APIDOC ## GET /v2/status ### Description Query the delivery status of sent messages by campaign ID, custom ID, or specific phone numbers. ### Method GET ### Endpoint `https://sms.verimor.com.tr/v2/status` ### Query Parameters - **username** (string) - Required - Your Verimor username. - **password** (string) - Required - Your Verimor API password (URL encoded). - **id** (string) - Optional - The campaign ID to filter by. - **custom_id** (string) - Optional - The custom ID to filter by. Use either `id` or `custom_id`. - **dest** (string) - Optional - Comma-separated list of destination phone numbers to filter by. - **greater_than** (string) - Optional - Filter messages with IDs greater than the specified value (useful for pagination). ### Request Example ```php message_id . ", Status: " . $msg->status . "\n"; // Status values: DELIVERED, NOT_DELIVERED, EXPIRED, SENDING, WAITING } ?> ``` ### Response #### Success Response (200) An array of message status objects. - **message_id** (string) - The unique identifier for the message. - **status** (string) - The delivery status of the message (e.g., DELIVERED, NOT_DELIVERED, EXPIRED, SENDING, WAITING). #### Response Example ```json [ { "message_id": "123456789", "status": "DELIVERED" } ] ``` ``` -------------------------------- ### Retrieve Inbound SMS Messages via HTTP GET (Bash) Source: https://context7.com/verimor/sms-api/llms.txt Fetches inbound SMS messages received on your Verimor number. Supports querying by date range or using a 'greater_than' parameter for pagination. Requires valid username and password. ```bash # Query by date range curl "https://sms.verimor.com.tr/v2/inbound_messages?username=908501234567&password=YOUR_API_PASSWORD&from_time=2017-01-01%2009:00:00&to_time=2017-01-01%2012:00:00" # Query messages newer than a specific ID (for pagination) curl "https://sms.verimor.com.tr/v2/inbound_messages?username=908501234567&password=YOUR_API_PASSWORD&greater_than=13582302" # Response (HTTP 200): [ { "message_id": 1234, "created_at": "2017-01-01T09:00:00.000+03:00", "network": "TURKCELL", "source_addr": "905335876543", "destination_addr": "908501234567", "keyword": "", "content": "Customer inquiry message", "received_at": "2017-01-01T10:00:00.000+03:00" } ] ``` -------------------------------- ### Retrieve Inbound SMS Messages Source: https://context7.com/verimor/sms-api/llms.txt Get SMS messages received on your Verimor number using either PUSH webhook or HTTP GET polling. This endpoint allows you to retrieve incoming messages. ```APIDOC ## GET /v2/inbound_messages ### Description Retrieve SMS messages received on your Verimor number. You can query messages by date range or by message ID for pagination. ### Method GET ### Endpoint `https://sms.verimor.com.tr/v2/inbound_messages` ### Query Parameters - **username** (string) - Required - Your Verimor username. - **password** (string) - Required - Your Verimor API password (URL encoded). - **from_time** (string) - Optional - Filter messages received after this timestamp (YYYY-MM-DD HH:MM:SS). - **to_time** (string) - Optional - Filter messages received before this timestamp (YYYY-MM-DD HH:MM:SS). - **greater_than** (integer) - Optional - Filter messages with IDs greater than the specified value (for pagination). ### Request Example ```bash # Query by date range curl "https://sms.verimor.com.tr/v2/inbound_messages?username=908501234567&password=YOUR_API_PASSWORD&from_time=2017-01-01%2009:00:00&to_time=2017-01-01%2012:00:00" # Query messages newer than a specific ID (for pagination) curl "https://sms.verimor.com.tr/v2/inbound_messages?username=908501234567&password=YOUR_API_PASSWORD&greater_than=13582302" ``` ### Response #### Success Response (200) An array of inbound message objects. - **message_id** (integer) - The unique identifier for the message. - **created_at** (string) - Timestamp when the message was created. - **network** (string) - The network provider of the sender. - **source_addr** (string) - The sender's phone number. - **destination_addr** (string) - Your Verimor number that received the message. - **keyword** (string) - The keyword, if any, used in the message. - **content** (string) - The content of the SMS message. - **received_at** (string) - Timestamp when the message was received. #### Response Example ```json [ { "message_id": 1234, "created_at": "2017-01-01T09:00:00.000+03:00", "network": "TURKCELL", "source_addr": "905335876543", "destination_addr": "908501234567", "keyword": "", "content": "Customer inquiry message", "received_at": "2017-01-01T10:00:00.000+03:00" } ] ``` ``` -------------------------------- ### Query SMS Delivery Reports via HTTP GET (PHP) Source: https://context7.com/verimor/sms-api/llms.txt Retrieves the delivery status of SMS messages using campaign ID, custom ID, or destination phone numbers. Requires cURL extension. Returns an array of message objects or false on error. ```php message_id}, Status: {$msg->status}\n"; // Status values: DELIVERED, NOT_DELIVERED, EXPIRED, SENDING, WAITING } ?> ``` -------------------------------- ### Cancel Scheduled SMS (Bash) Source: https://context7.com/verimor/sms-api/llms.txt Bash command using `curl` to cancel a previously scheduled SMS campaign. It sends an HTTP POST request to the `/v2/cancel/{campaign_id}` endpoint with JSON authentication credentials. It shows example success and failure responses. ```bash curl -X POST "https://sms.verimor.com.tr/v2/cancel/20121" \ -H "Content-Type: application/json" \ -d '{"username": "908501234567", "password": "YOUR_API_PASSWORD"}' # Response (Success - HTTP 200): Kampanya silindi: 20121 # Response (Failure - HTTP 400): Kampanya bulunamadı: 20121 ``` -------------------------------- ### Query IYS Campaigns and Consent Reports (Bash) Source: https://context7.com/verimor/sms-api/llms.txt Allows listing IYS consent campaigns and retrieving detailed consent status reports for a specific campaign. Requires username and password for authentication. ```bash # List IYS campaigns curl "https://sms.verimor.com.tr/v2/iys/campaigns?username=908501234567&password=YOUR_API_PASSWORD&offset=0&limit=100" # Get consent details for a specific IYS campaign curl "https://sms.verimor.com.tr/v2/iys/campaigns/103/consents?username=908501234567&password=YOUR_API_PASSWORD&offset=0&limit=100" ``` -------------------------------- ### Send SMS via HTTP POST (C#) Source: https://context7.com/verimor/sms-api/llms.txt C# implementation for sending SMS using `WebClient` and Newtonsoft.Json for serialization. It requires the Newtonsoft.Json NuGet package. The code defines classes for the SMS request, serializes an instance to JSON, and sends it via POST. It prints the campaign ID or error details. ```csharp using System; using System.Net; using System.Text; using System.IO; using Newtonsoft.Json; class Mesaj { public string msg { get; set; } public string dest { get; set; } public Mesaj(string msg, string dest) { this.msg = msg; this.dest = dest; } } class SmsIstegi { public string username { get; set; } public string password { get; set; } public string source_addr { get; set; } public Mesaj[] messages { get; set; } } class Program { static void Main() { var smsRequest = new SmsIstegi { username = "908501234567", password = "YOUR_API_PASSWORD", source_addr = "MYHEADER", messages = new Mesaj[] { new Mesaj("Test message", "905351234567") } }; string payload = JsonConvert.SerializeObject(smsRequest); WebClient wc = new WebClient(); wc.Encoding = Encoding.UTF8; wc.Headers["Content-Type"] = "application/json"; try { string campaignId = wc.UploadString("https://sms.verimor.com.tr/v2/send.json", payload); Console.WriteLine("Campaign ID: " + campaignId); } catch (WebException ex) { var responseBody = new StreamReader(ex.Response.GetResponseStream()).ReadToEnd(); Console.WriteLine("Error: " + responseBody); } } } ``` -------------------------------- ### Submit IYS Consent Records (Bash) Source: https://context7.com/verimor/sms-api/llms.txt Submits customer consent records to Turkey's IYS system for commercial messaging compliance. Requires username, password, source address, and a list of consent objects. ```bash curl -X POST "https://sms.verimor.com.tr/v2/iys_consents.json" \ -H "Content-Type: application/json" \ -d '{ "username": "908501234567", "password": "YOUR_API_PASSWORD", "source_addr": "MYHEADER", "consents": [ { "type": "MESAJ", "source": "HS_WEB", "status": "ONAY", "recipient_type": "BIREYSEL", "consent_date": "2022-04-14 13:30:30", "recipient": "905311234567" }, { "type": "EPOSTA", "source": "HS_MESAJ", "status": "RET", "recipient_type": "BIREYSEL", "consent_date": "2022-04-14 13:30:30", "recipient": "customer@example.com" } ] }' ``` -------------------------------- ### Query Account Balance Source: https://context7.com/verimor/sms-api/llms.txt Check your remaining SMS credits. This endpoint provides a simple way to monitor your account balance. ```APIDOC ## GET /v2/balance ### Description Check your remaining SMS credits. ### Method GET ### Endpoint `https://sms.verimor.com.tr/v2/balance` ### Query Parameters - **username** (string) - Required - Your Verimor username. - **password** (string) - Required - Your Verimor API password (URL encoded). ### Request Example ```php ``` ### Response #### Success Response (200) An integer representing the number of remaining SMS credits. #### Response Example ``` 4532 ``` ``` -------------------------------- ### Manage Blacklist via HTTP GET/POST/DELETE (Bash) Source: https://context7.com/verimor/sms-api/llms.txt Manages the blacklist of phone numbers to prevent sending messages. Supports listing numbers with pagination, adding numbers via POST, and removing numbers via DELETE. Requires valid credentials. ```bash # List blacklisted numbers (paginated, max 100 per request) curl "https://sms.verimor.com.tr/v2/blacklists?username=908501234567&password=YOUR_API_PASSWORD&offset=0&limit=100" # Response: { "total": 2, "records": [ {"created_at": "2019-11-25T11:13:24.988+03:00", "phone": "905444876543", "source": "ret_web"}, {"created_at": "2020-06-02T16:59:56.957+03:00", "phone": "905335876543", "source": "oim"} ] } # Add numbers to blacklist curl -X POST "https://sms.verimor.com.tr/v2/blacklists?username=908501234567&password=YOUR_API_PASSWORD&phones=905444876543,905335876543" # Response: OK # Remove numbers from blacklist curl -X DELETE "https://sms.verimor.com.tr/v2/blacklists/905444876543,905335876543?username=908501234567&password=YOUR_API_PASSWORD" # Response: OK ``` -------------------------------- ### Receive Incoming SMS using Verimor API in Java Source: https://github.com/verimor/sms-api/blob/master/sample_codes/README.md Shows how to receive incoming SMS messages using the Verimor SMS API in Java. This usually involves setting up a webhook or an endpoint to receive notifications from Verimor. ```java // Example Java code for receiving incoming SMS (Servlet) import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; @WebServlet("/inbound-sms") public class InboundSmsReceiver extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String sender = request.getParameter("sender"); String message = request.getParameter("message"); String date = request.getParameter("date"); response.setContentType("text/plain"); PrintWriter out = response.getWriter(); out.println("Received SMS:"); out.println("Sender: " + sender); out.println("Message: " + message); out.println("Date: " + date); // Process the incoming SMS here } } ``` -------------------------------- ### Query IYS Campaigns and Consent Reports Source: https://context7.com/verimor/sms-api/llms.txt List IYS consent campaigns and retrieve detailed consent status reports. ```APIDOC ## GET /v2/iys/campaigns ### Description List IYS consent campaigns. ### Method GET ### Endpoint https://sms.verimor.com.tr/v2/iys/campaigns ### Parameters #### Query Parameters - **username** (string) - Required - Your Verimor username. - **password** (string) - Required - Your Verimor API password. - **offset** (integer) - Optional - Number of records to skip (default: 0). - **limit** (integer) - Optional - Maximum number of records to return (default: 100). ### Response #### Success Response (200) - **records** (array) - A list of campaign objects. - **id** (integer) - The campaign ID. - **header_name** (string) - The sender ID (header) used for the campaign. - **iys_code** (integer) - The IYS system code for the campaign. - **source** (string) - The source of the campaign creation (e.g., "api"). - **created_at** (string) - The timestamp when the campaign was created. - **total** (integer) - The total number of campaigns available. #### Response Example ```json { "records": [ {"id": 103, "header_name": "MYHEADER", "iys_code": 627033, "source": "api", "created_at": "2021-02-10T11:58:57.508+03:00"} ], "total": 1 } ``` ## GET /v2/iys/campaigns/{id}/consents ### Description Retrieve detailed consent status reports for a specific IYS campaign. ### Method GET ### Endpoint https://sms.verimor.com.tr/v2/iys/campaigns/{id}/consents ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the IYS campaign. #### Query Parameters - **username** (string) - Required - Your Verimor username. - **password** (string) - Required - Your Verimor API password. - **offset** (integer) - Optional - Number of records to skip (default: 0). - **limit** (integer) - Optional - Maximum number of records to return (default: 100). ### Response #### Success Response (200) - **total** (integer) - The total number of consent records for the campaign. - **source_addr** (string) - The sender ID (header) associated with the campaign. - **status** (string) - The overall status of the consent report (e.g., "Tamamlandı"). - **records** (array) - A list of individual consent records. - **type** (string) - The type of consent (e.g., "MESAJ"). - **recipient** (string) - The recipient's identifier. - **status** (string) - The status of the consent for this recipient (e.g., "ONAY", "RET"). - **request_status** (string) - The status of the request to IYS (e.g., "Başarılı", "Başarısız"). - **request_error** (string) - (Optional) Error message if the request status is "Başarısız". #### Response Example ```json { "total": 2, "source_addr": "MYHEADER", "status": "Tamamlandı", "records": [ {"type": "MESAJ", "recipient": "905331001727", "status": "ONAY", "request_status": "Başarılı"}, {"type": "MESAJ", "recipient": "905331001017", "status": "RET", "request_status": "Başarısız", "request_error": "H175 Error message"} ] } ``` ``` -------------------------------- ### Send SMS using Verimor API in C# Source: https://github.com/verimor/sms-api/blob/master/sample_codes/README.md Illustrates sending SMS messages via the Verimor SMS API using C#. This involves constructing HTTP requests and handling responses, often using `HttpClient`. ```csharp // Example C# code for sending SMS using System; using System.Net.Http; using System.Threading.Tasks; public class SmsSender { public async Task SendSmsAsync(string apiKey, string message, string phoneNumber) { using (var client = new HttpClient()) { var values = new Dictionary { { "key", apiKey }, { "message", message }, { "recipient", phoneNumber } }; var content = new FormUrlEncodedContent(values); var response = await client.PostAsync("https://api.verimor.net/v2/send.php", content); var responseString = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseString); } } } ``` -------------------------------- ### Send SMS via HTTP POST (Java) Source: https://context7.com/verimor/sms-api/llms.txt Java implementation for sending SMS using `HttpURLConnection` and Gson for JSON serialization. It requires the Gson library. The code constructs an SMS request object, serializes it to JSON, and sends it via POST to the Verimor API. It prints the campaign ID or stack trace on error. ```java import com.google.gson.Gson; import java.io.*; import java.net.*; class Mesaj { String msg; String dest; public Mesaj(String msg, String dest) { this.msg = msg; this.dest = dest; } } class SmsIstegi { public String username; public String password; public String source_addr; public Mesaj[] messages; } public class VerimorSms { public static void main(String[] args) { SmsIstegi si = new SmsIstegi(); si.username = "908501234567"; si.password = "YOUR_API_PASSWORD"; si.source_addr = "MYHEADER"; si.messages = new Mesaj[]{ new Mesaj("Test message", "905351234567") }; Gson gson = new Gson(); String payload = gson.toJson(si); try { URL url = new URL("https://sms.verimor.com.tr/v2/send.json"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(true); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/json"); OutputStreamWriter writer = new OutputStreamWriter(conn.getOutputStream(), "UTF-8"); writer.write(payload); writer.flush(); if (conn.getResponseCode() == 200) { BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); System.out.println("Campaign ID: " + reader.readLine()); } conn.disconnect(); } catch (IOException ex) { ex.printStackTrace(); } } } ``` -------------------------------- ### Receive Delivery Reports using Verimor API in Java Source: https://github.com/verimor/sms-api/blob/master/sample_codes/README.md Demonstrates how to receive delivery reports for sent SMS messages using the Verimor SMS API in Java. Similar to inbound SMS, this often uses a webhook endpoint. ```java // Example Java code for receiving delivery reports (Servlet) import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; @WebServlet("/delivery-report") public class DeliveryReportReceiver extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String messageId = request.getParameter("messageid"); String status = request.getParameter("status"); String phoneNumber = request.getParameter("recipient"); response.setContentType("text/plain"); PrintWriter out = response.getWriter(); out.println("Received Delivery Report:"); out.println("Message ID: " + messageId); out.println("Status: " + status); out.println("Recipient: " + phoneNumber); // Process the delivery report here } } ``` -------------------------------- ### Send SMS using Verimor API in PHP Source: https://github.com/verimor/sms-api/blob/master/sample_codes/README.md Shows how to send SMS messages using the Verimor SMS API in PHP. This involves making POST requests to the API endpoint with necessary parameters. ```php $apiKey, 'message' => $message, 'recipient' => $phoneNumber ]; $options = [ 'http' => [ 'header' => "Content-type: application/x-www-form-urlencoded\r\n", 'method' => 'POST', 'content' => http_build_query($data) ] ]; $context = stream_context_create($options); $result = file_get_contents($url, false, $context); if ($result === FALSE) { /* Handle error */ } else { echo $result; } ?> ``` -------------------------------- ### Send SMS using Verimor API in ASP Source: https://github.com/verimor/sms-api/blob/master/sample_codes/README.md Demonstrates how to send SMS messages using the Verimor SMS API in ASP. This code typically involves making HTTP requests to the API endpoint. ```asp <% Dim url, apiKey, message, phoneNumber url = "https://api.verimor.net/v2/send.php" apiKey = "YOUR_API_KEY" message = "Hello from Verimor API!" phoneNumber = "+905XXXXXXXXX" Dim http Set http = Server.CreateObject("MSXML2.ServerXMLHTTP") http.open "POST", url, False http.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded" http.send "key=" & apiKey & "&message=" & Server.UrlEncode(message) & "&recipient=" & phoneNumber Response.Write http.responseText Set http = Nothing %> ``` -------------------------------- ### Receive Delivery Reports via PUSH (Webhook) Source: https://context7.com/verimor/sms-api/llms.txt Configure a webhook URL in your OIM panel to receive real-time delivery status updates. The API will POST JSON data to your endpoint when a message status changes. ```APIDOC ## PUSH /webhook ### Description Receive real-time delivery status updates via a webhook. The API will POST JSON data to your configured URL when a message status changes. ### Method POST ### Endpoint Your configured webhook URL ### Request Body An array of delivery status objects. - **type** (string) - The type of message (e.g., "outbound"). - **campaign_id** (integer) - The campaign ID associated with the message. - **campaign_custom_id** (string) - The custom ID of the campaign. - **message_id** (string) - The unique identifier for the message. - **message_custom_id** (string) - The custom ID of the message. - **dest** (string) - The destination phone number. - **size** (integer) - The size of the message in parts. - **international_multiplier** (integer) - The international multiplier for credit calculation. - **credits** (integer) - The number of credits used for the message. - **status** (string) - The delivery status (e.g., DELIVERED, NOT_DELIVERED, EXPIRED, SENDING, WAITING). - **gsm_error** (string) - GSM error code, if any. - **sent_at** (string) - Timestamp when the message was sent. - **done_at** (string) - Timestamp when the message status was updated. ### Request Example ```json [ { "type": "outbound", "campaign_id": 20121, "campaign_custom_id": "my-campaign-001", "message_id": "13582302", "message_custom_id": "msg-001", "dest": "905319876543", "size": 1, "international_multiplier": 1, "credits": 1, "status": "DELIVERED", "gsm_error": "0", "sent_at": "2015-02-20 16:06:00", "done_at": "2015-02-20 16:06:00" } ] ``` ``` -------------------------------- ### List SMS Headers (Sender IDs) Source: https://context7.com/verimor/sms-api/llms.txt Retrieve all approved sender IDs (headers) for your account. This is useful for knowing which sender IDs you can use for sending messages. ```APIDOC ## GET /v2/headers ### Description Retrieve all approved sender IDs (headers) for your account. ### Method GET ### Endpoint `https://sms.verimor.com.tr/v2/headers` ### Query Parameters - **username** (string) - Required - Your Verimor username. - **password** (string) - Required - Your Verimor API password (URL encoded). ### Request Example ```bash curl "https://sms.verimor.com.tr/v2/headers?username=908501234567&password=YOUR_API_PASSWORD" ``` ### Response #### Success Response (200) An array of strings, where each string is an approved sender ID. #### Response Example ```json ["VERIMOR", "MYCOMPANY", "ALERTS"] ``` #### Error Response (401) - **Error Message** (string) - "Geçersiz kullanıcı adı/şifre" ``` -------------------------------- ### Send IYS Consents Source: https://context7.com/verimor/sms-api/llms.txt Submit customer consent records to Turkey's IYS system for commercial messaging compliance. ```APIDOC ## POST /v2/iys_consents.json ### Description Submit customer consent records to Turkey's IYS system for commercial messaging compliance. ### Method POST ### Endpoint https://sms.verimor.com.tr/v2/iys_consents.json ### Parameters #### Request Body - **username** (string) - Required - Your Verimor username. - **password** (string) - Required - Your Verimor API password. - **source_addr** (string) - Required - The sender ID (header) for the consent. - **consents** (array) - Required - A list of consent objects. - **type** (string) - Required - Type of consent (e.g., "MESAJ", "EPOSTA"). - **source** (string) - Required - Source of the consent (e.g., "HS_WEB", "HS_MESAJ"). - **status** (string) - Required - Consent status (e.g., "ONAY", "RET"). - **recipient_type** (string) - Required - Type of recipient (e.g., "BIREYSEL"). - **consent_date** (string) - Required - Date and time of consent (YYYY-MM-DD HH:MM:SS). - **recipient** (string) - Required - The recipient's identifier (phone number or email). ### Request Example ```json { "username": "908501234567", "password": "YOUR_API_PASSWORD", "source_addr": "MYHEADER", "consents": [ { "type": "MESAJ", "source": "HS_WEB", "status": "ONAY", "recipient_type": "BIREYSEL", "consent_date": "2022-04-14 13:30:30", "recipient": "905311234567" }, { "type": "EPOSTA", "source": "HS_MESAJ", "status": "RET", "recipient_type": "BIREYSEL", "consent_date": "2022-04-14 13:30:30", "recipient": "customer@example.com" } ] } ``` ### Response #### Success Response (200) - **response** (integer) - A unique ID for the request. #### Response Example ``` 20212 ``` ``` -------------------------------- ### SMS Character Limits Reference Source: https://context7.com/verimor/sms-api/llms.txt Reference table for message size calculations based on the 'datacoding' parameter. ```APIDOC ## SMS Character Limits Reference ### Description Reference table for message size calculations based on the `datacoding` parameter. ### Table ``` | Size | Normal (datacoding=0) | Turkish (datacoding=1) | Unicode (datacoding=2) | |------|-----------------------|------------------------|------------------------| | 1 | 0-160 chars | 0-155 chars | 0-70 chars | | 2 | 161-306 chars | 156-298 chars | 71-134 chars | | 3 | 307-459 chars | 299-447 chars | 135-201 chars | | 4 | 460-612 chars | 448-596 chars | 202-268 chars | | 5 | 613-765 chars | 597-745 chars | 269-335 chars | | 6 | 766-918 chars | 746-894 chars | 336-402 chars | | 7 | 919-1071 chars | 895-1043 chars | 403-469 chars | ``` ### Notes - Characters `^ { } \ [ ] ~ | €` count as 2 characters in `datacoding=0` and `datacoding=1`. - Turkish characters (Ş ş Ğ ğ ç ı İ) require `datacoding=1`. ``` -------------------------------- ### Send SMS to Multiple Recipients using Verimor API in Python Source: https://github.com/verimor/sms-api/blob/master/sample_codes/README.md Demonstrates sending a single SMS message to multiple recipients using the Verimor SMS API in Python. This script utilizes the `requests` library for HTTP communication. ```python # Example Python code for sending SMS to multiple recipients import requests api_key = "YOUR_API_KEY" message = "Hello, this is a test message." recipients = ["+905XXXXXXXXX", "+905YYYYYYYYY", "+905ZZZZZZZZZ"] url = "https://api.verimor.net/v2/send.php" for recipient in recipients: payload = { "key": api_key, "message": message, "recipient": recipient } try: response = requests.post(url, data=payload) response.raise_for_status() # Raise an exception for bad status codes print(f"Sent to {recipient}: {response.text}") except requests.exceptions.RequestException as e: print(f"Error sending to {recipient}: {e}") ``` -------------------------------- ### Receive SMS Delivery Reports via PUSH (Webhook) Source: https://context7.com/verimor/sms-api/llms.txt Receives real-time SMS delivery status updates via HTTP POST to a configured webhook URL. The API sends a JSON array containing delivery report objects. ```json [ { "type": "outbound", "campaign_id": 20121, "campaign_custom_id": "my-campaign-001", "message_id": "13582302", "message_custom_id": "msg-001", "dest": "905319876543", "size": 1, "international_multiplier": 1, "credits": 1, "status": "DELIVERED", "gsm_error": "0", "sent_at": "2015-02-20 16:06:00", "done_at": "2015-02-20 16:06:00" } ] ``` -------------------------------- ### Common Error Codes Source: https://context7.com/verimor/sms-api/llms.txt Reference for API error responses when sending messages. ```APIDOC ## Common Error Codes ### Description Reference for API error responses when sending messages. ### Table ``` | Error Code | Description | |-------------------------------|-------------------------------------------------------| | INVALID_SOURCE_ADDRESS | Sender ID (header) not approved | | MISSING_MESSAGE | Message text not provided | | MESSAGE_TOO_LONG | Message exceeds maximum length | | INVALID_PERIOD | Validity period invalid (must be 1min - 48hrs) | | INVALID_DELIVERY_TIME | send_at parameter invalid or in the past | | MISSING_DESTINATION_ADDRESS | No recipient phone numbers provided | | INVALID_DESTINATION_ADDRESS | Phone number format invalid (should be 905XXXXXXXXX) | | INSUFFICIENT_CREDITS | Not enough balance to send messages | | FORBIDDEN_MESSAGE | Message contains prohibited content | | INVALID_JSON | Malformed JSON in request body | | MESSAGE_COUNT_LIMIT_EXCEEDED | Max 50,000 messages per request exceeded | ``` ``` -------------------------------- ### Send SMS via HTTP POST (Python) Source: https://context7.com/verimor/sms-api/llms.txt Python function to send SMS messages using an HTTP POST request with JSON payload. It requires the `json` and `http.client` libraries. The function takes a header, message, and recipient phone numbers as input and returns a campaign ID on success. ```python import json import http.client def send_sms(header, message, phones): sms_msg = { 'username': '908501234567', 'password': 'YOUR_API_PASSWORD', 'source_addr': header, 'messages': [ {'msg': message, 'dest': phones} ] } conn = http.client.HTTPSConnection('sms.verimor.com.tr') headers = {'Content-type': 'application/json'} conn.request("POST", "/v2/send.json", json.dumps(sms_msg), headers) response = conn.getresponse() if response.status == 200: campaign_id = response.read().decode() conn.close() return campaign_id conn.close() return None campaign_id = send_sms("MYHEADER", "Test message", "905321112233,905321112234") print(f"Campaign ID: {campaign_id}") ``` -------------------------------- ### Send SMS Source: https://context7.com/verimor/sms-api/llms.txt This endpoint allows you to send SMS messages. You can send messages to multiple recipients by separating phone numbers with commas. The API supports sending messages with a specified header and content. ```APIDOC ## POST /v2/send.json ### Description Send SMS messages to one or more recipients. ### Method POST ### Endpoint https://sms.verimor.com.tr/v2/send.json ### Parameters #### Request Body - **username** (string) - Required - Your Verimor username. - **password** (string) - Required - Your Verimor API password. - **source_addr** (string) - Required - The sender ID or header of the SMS. - **messages** (array) - Required - An array of message objects. - **msg** (string) - Required - The content of the SMS message. - **dest** (string) - Required - The recipient's phone number(s), comma-separated if multiple. ### Request Example ```json { "username": "908501234567", "password": "YOUR_API_PASSWORD", "source_addr": "MYHEADER", "messages": [ {"msg": "Test message", "dest": "905321112233,905321112234"} ] } ``` ### Response #### Success Response (200) - **campaign_id** (string) - The ID of the sent campaign. #### Response Example ``` 20121 ``` ```