רשימות תפוצה
רשימות נמענים שנשמרות בצד של TextMe. כל חבר יכול לשאת עד שישה שדות דינמיים — ערכים כרצונכם, כמו שם פרטי או עיר — שאפשר לשלב בגוף ההודעה בזמן השליחה.
שש פעולות מכסות את מחזור החיים: יצירה, מחיקה, הוספת מספרים, הסרת מספרים, קריאת הכול, קריאת רשימה אחת.
POST https://my.textme.co.il/apiהפעולות האלה מדווחות על כשלים ברמת השורה בנפרד
מספר טלפון פגום אינו מכשיל את הקריאה. הרשימה עדיין נוצרת או מתעדכנת, ה-status חוזר 0, והשורות שנדחו מופיעות ב-errors. קריאת status בלבד תיצור את הרושם שכל אנשי הקשר נשמרו. ראו הצלחה חלקית.
newCL יצירת רשימות תפוצה
יוצרת רשימה אחת או יותר, עם אפשרות לאכלס אותן באותה קריאה.
פרמטרים
| שם | סוג | תיאור | חובה |
|---|---|---|---|
newCL | object | מכיל את כל האלמנטים האחרים. | ✔️ |
user | object | מכיל את אלמנט המשתמש. | ✔️ |
username | string | שם המשתמש של החשבון שבו אתם מזוהים במערכת. | ✔️ |
cl | object | פרטי רשימת תפוצה ליצירה. חזרתי — כמה רשימות בקריאה אחת. | ✔️ |
cl.name | string | שם הרשימה. | ✔️ |
destinations | object | מכיל את כל המספרים שנוספים לרשימה הזו. | ✔️ |
destination | object | איש קשר אחד. חזרתי. | ✔️ |
phone | int | מספר איש הקשר, בפורמט 5xxxxxxx או 05xxxxxxx. | ✔️ |
df1 … df6 | string | שדות דינמיים לאיש הקשר — עד שישה לכל שורה. | ➖ |
דוגמת בקשה
<?xml version="1.0" encoding="UTF-8"?>
<newCL>
<user>
<username>xxxxxx</username>
</user>
<cl>
<name>name1</name>
<destinations>
<destination>
<phone>055XXXXXXX</phone>
<df1>Israel</df1>
<df2>Israeli</df2>
<df3>Haifa</df3>
</destination>
<destination>
<phone>55XXXXXXX</phone>
</destination>
</destinations>
</cl>
<cl>
<name>name2</name>
<destinations>
<destination>
<phone>055XXXXXXX</phone>
</destination>
</destinations>
</cl>
</newCL>{
"newCL": {
"user": {
"username": "xxxxxx"
},
"cl": [
{
"name": "name1",
"destinations": {
"destination": [
{
"phone": "055XXXXXXX",
"df1": "Israel",
"df2": "Israeli",
"df3": "Haifa"
},
{
"phone": "55XXXXXXX"
}
]
}
},
{
"name": "name2",
"destinations": {
"destination": [
{
"phone": "055XXXXXXX"
}
]
}
}
]
}
}curl --location 'https://my.textme.co.il/api' \
--header "Authorization: Bearer $TEXTME_API_TOKEN" \
--header 'Content-Type: application/json' \
--data '{
"newCL": {
"user": {
"username": "xxxxxx"
},
"cl": [
{
"name": "name1",
"destinations": {
"destination": [
{
"phone": "055XXXXXXX",
"df1": "Israel",
"df2": "Israeli",
"df3": "Haifa"
},
{
"phone": "55XXXXXXX"
}
]
}
},
{
"name": "name2",
"destinations": {
"destination": [
{
"phone": "055XXXXXXX"
}
]
}
}
]
}
}'// Node.js 18+ / דפדפנים — ללא תלויות
const response = await fetch('https://my.textme.co.il/api', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.TEXTME_API_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
newCL: {
user: {
username: 'xxxxxx',
},
cl: [
{
name: 'name1',
destinations: {
destination: [
{
phone: '055XXXXXXX',
df1: 'Israel',
df2: 'Israeli',
df3: 'Haifa',
},
{
phone: '55XXXXXXX',
},
],
},
},
{
name: 'name2',
destinations: {
destination: [
{
phone: '055XXXXXXX',
},
],
},
},
],
},
}),
})
const result = await response.json()
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
if (Number(result.status) !== 0) {
throw new Error(`TextMe ${result.status}: ${result.message}`)
}
console.log(result)<?php
// composer require guzzlehttp/guzzle
$client = new \GuzzleHttp\Client([
'headers' => [
'Authorization' => 'Bearer '.getenv('TEXTME_API_TOKEN'),
'Accept' => 'application/json',
],
]);
$response = $client->post('https://my.textme.co.il/api', [
'json' => [
'newCL' => [
'user' => [
'username' => 'xxxxxx',
],
'cl' => [
[
'name' => 'name1',
'destinations' => [
'destination' => [
[
'phone' => '055XXXXXXX',
'df1' => 'Israel',
'df2' => 'Israeli',
'df3' => 'Haifa',
],
[
'phone' => '55XXXXXXX',
],
],
],
],
[
'name' => 'name2',
'destinations' => [
'destination' => [
[
'phone' => '055XXXXXXX',
],
],
],
],
],
],
],
]);
$result = json_decode($response->getBody()->getContents(), true);
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
if ((int) $result['status'] !== 0) {
throw new RuntimeException("TextMe {$result['status']}: {$result['message']}");
}
print_r($result);<?php
use Illuminate\Support\Facades\Http;
$result = Http::withToken(config('services.textme.token'))
->acceptJson()
->post('https://my.textme.co.il/api', [
'newCL' => [
'user' => [
'username' => 'xxxxxx',
],
'cl' => [
[
'name' => 'name1',
'destinations' => [
'destination' => [
[
'phone' => '055XXXXXXX',
'df1' => 'Israel',
'df2' => 'Israeli',
'df3' => 'Haifa',
],
[
'phone' => '55XXXXXXX',
],
],
],
],
[
'name' => 'name2',
'destinations' => [
'destination' => [
[
'phone' => '055XXXXXXX',
],
],
],
],
],
],
])
->throw()
->json();
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
throw_if((int) $result['status'] !== 0, RuntimeException::class,
"TextMe {$result['status']}: {$result['message']}");
logger()->info('TextMe', $result);# pip install httpx
import os
import httpx
response = httpx.post(
"https://my.textme.co.il/api",
headers={"Authorization": f"Bearer {os.environ['TEXTME_API_TOKEN']}"},
json={
"newCL": {
"user": {
"username": "xxxxxx",
},
"cl": [
{
"name": "name1",
"destinations": {
"destination": [
{
"phone": "055XXXXXXX",
"df1": "Israel",
"df2": "Israeli",
"df3": "Haifa",
},
{
"phone": "55XXXXXXX",
},
],
},
},
{
"name": "name2",
"destinations": {
"destination": [
{
"phone": "055XXXXXXX",
},
],
},
},
],
},
},
)
response.raise_for_status()
result = response.json()
# גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
if int(result["status"]) != 0:
raise RuntimeError(f"TextMe {result['status']}: {result['message']}")
print(result)package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"os"
)
func main() {
payload, _ := json.Marshal(map[string]any{
"newCL": map[string]any{
"user": map[string]any{
"username": "xxxxxx",
},
"cl": []any{
map[string]any{
"name": "name1",
"destinations": map[string]any{
"destination": []any{
map[string]any{
"phone": "055XXXXXXX",
"df1": "Israel",
"df2": "Israeli",
"df3": "Haifa",
},
map[string]any{
"phone": "55XXXXXXX",
},
},
},
},
map[string]any{
"name": "name2",
"destinations": map[string]any{
"destination": []any{
map[string]any{
"phone": "055XXXXXXX",
},
},
},
},
},
},
})
req, _ := http.NewRequest("POST", "https://my.textme.co.il/api", bytes.NewReader(payload))
req.Header.Set("Authorization", "Bearer "+os.Getenv("TEXTME_API_TOKEN"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
var result struct {
Status json.Number `json:"status"`
Message string `json:"message"`
}
if err := json.NewDecoder(res.Body).Decode(&result); err != nil {
panic(err)
}
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
if result.Status.String() != "0" {
panic(fmt.Sprintf("TextMe %s: %s", result.Status, result.Message))
}
fmt.Println(result.Message)
}// Java 17+ — java.net.http, ללא תלויות (פענוח עם Jackson/Gson)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class TextMeClCreate {
public static void main(String[] args) throws Exception {
String body = """
{
"newCL": {
"user": {
"username": "xxxxxx"
},
"cl": [
{
"name": "name1",
"destinations": {
"destination": [
{
"phone": "055XXXXXXX",
"df1": "Israel",
"df2": "Israeli",
"df3": "Haifa"
},
{
"phone": "55XXXXXXX"
}
]
}
},
{
"name": "name2",
"destinations": {
"destination": [
{
"phone": "055XXXXXXX"
}
]
}
}
]
}
}
""";
HttpRequest request = HttpRequest.newBuilder(URI.create("https://my.textme.co.il/api"))
.header("Authorization", "Bearer " + System.getenv("TEXTME_API_TOKEN"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
System.out.println(response.body());
}
}// .NET 8+ — System.Net.Http
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
var payload = """
{
"newCL": {
"user": {
"username": "xxxxxx"
},
"cl": [
{
"name": "name1",
"destinations": {
"destination": [
{
"phone": "055XXXXXXX",
"df1": "Israel",
"df2": "Israeli",
"df3": "Haifa"
},
{
"phone": "55XXXXXXX"
}
]
}
},
{
"name": "name2",
"destinations": {
"destination": [
{
"phone": "055XXXXXXX"
}
]
}
}
]
}
}
""";
using var http = new HttpClient();
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(
"Bearer", Environment.GetEnvironmentVariable("TEXTME_API_TOKEN"));
var response = await http.PostAsync("https://my.textme.co.il/api",
new StringContent(payload, Encoding.UTF8, "application/json"));
var result = JsonDocument.Parse(await response.Content.ReadAsStringAsync()).RootElement;
var status = result.GetProperty("status").ToString();
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
if (status != "0")
{
var message = result.GetProperty("message").ToString();
throw new Exception($"TextMe {status}: {message}");
}
Console.WriteLine(result);require "net/http"
require "json"
uri = URI("https://my.textme.co.il/api")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer #{ENV.fetch('TEXTME_API_TOKEN')}"
request["Content-Type"] = "application/json"
request.body = JSON.dump({
"newCL" => {
"user" => {
"username" => "xxxxxx",
},
"cl" => [
{
"name" => "name1",
"destinations" => {
"destination" => [
{
"phone" => "055XXXXXXX",
"df1" => "Israel",
"df2" => "Israeli",
"df3" => "Haifa",
},
{
"phone" => "55XXXXXXX",
},
],
},
},
{
"name" => "name2",
"destinations" => {
"destination" => [
{
"phone" => "055XXXXXXX",
},
],
},
},
],
},
})
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
result = JSON.parse(response.body)
# גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
raise "TextMe #{result['status']}: #{result['message']}" unless result["status"].to_i.zero?
pp result// [dependencies]
// reqwest = { version = "0.12", features = ["json"] }
// tokio = { version = "1", features = ["full"] }
// serde_json = "1"
use serde_json::{json, Value};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let result: Value = reqwest::Client::new()
.post("https://my.textme.co.il/api")
.bearer_auth(std::env::var("TEXTME_API_TOKEN")?)
.json(&json!({
"newCL": {
"user": {
"username": "xxxxxx"
},
"cl": [
{
"name": "name1",
"destinations": {
"destination": [
{
"phone": "055XXXXXXX",
"df1": "Israel",
"df2": "Israeli",
"df3": "Haifa"
},
{
"phone": "55XXXXXXX"
}
]
}
},
{
"name": "name2",
"destinations": {
"destination": [
{
"phone": "055XXXXXXX"
}
]
}
}
]
}
}))
.send()
.await?
.json()
.await?;
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
if result["status"] != 0 {
return Err(format!("TextMe {}: {}", result["status"], result["message"]).into());
}
println!("{result}");
Ok(())
}תשובה
<?xml version="1.0" encoding="UTF-8"?>
<newCL>
<status>0</status>
<message>conact list successfully created</message>
<errors>
<error>The phone is too long or too short or contain characters and therefore not added</error>
</errors>
<identifiers>
<identifier>17419</identifier>
</identifiers>
</newCL>{
"status": 0,
"message": "conact list successfully created",
"errors": [
"The phone is too long or too short or contain characters and therefore not added"
],
"identifiers": "17419"
}| שדה | סוג | תיאור |
|---|---|---|
status | int | 0 — הרשימות נוצרו. |
message | string | conact list successfully created — שגיאת הכתיב היא ב-API. |
errors | array | השורות שנדחו. ריק או נעדר כשכל אנשי הקשר נשמרו. |
identifiers | string / array | המזהה של כל רשימה שנוצרה. זהו ה-cl_id שאליו שולחים הודעות. |
שמרו את identifiers
זה המקום היחיד שבו המזהה של הרשימה החדשה מופיע. אם תאבדו אותו תצטרכו לחפש אותו עם getCL.
שגיאות
| Status | מתי |
|---|---|
2 | חסר cl, name או destinations. |
9 | יעד פגום — אבל שימו לב שזה מגיע בדרך כלל כרשומה ב-errors ולא ככשל של הקריאה. |
511 | החשבון אינו רשאי לבצע את הפעולה. |
removeCL מחיקת רשימות תפוצה
פרמטרים
| שם | סוג | תיאור | חובה |
|---|---|---|---|
removeCL | object | מכיל את כל האלמנטים האחרים. | ✔️ |
user | object | מכיל את אלמנט המשתמש. | ✔️ |
username | string | שם המשתמש של החשבון שבו אתם מזוהים במערכת. | ✔️ |
cl | object | מכיל את המזהים שברצונכם להסיר. | ✔️ |
id | string | מזהה של רשימת תפוצה להסרה. חזרתי. | ✔️ |
דוגמת בקשה
<?xml version="1.0" encoding="UTF-8"?>
<removeCL>
<user>
<username>xxxxxx</username>
</user>
<cl>
<id>21518</id>
<id>21500</id>
</cl>
</removeCL>{
"removeCL": {
"user": {
"username": "xxxxxx"
},
"cl": {
"id": [
"21518",
"21500"
]
}
}
}curl --location 'https://my.textme.co.il/api' \
--header "Authorization: Bearer $TEXTME_API_TOKEN" \
--header 'Content-Type: application/json' \
--data '{
"removeCL": {
"user": {
"username": "xxxxxx"
},
"cl": {
"id": [
"21518",
"21500"
]
}
}
}'// Node.js 18+ / דפדפנים — ללא תלויות
const response = await fetch('https://my.textme.co.il/api', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.TEXTME_API_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
removeCL: {
user: {
username: 'xxxxxx',
},
cl: {
id: [
'21518',
'21500',
],
},
},
}),
})
const result = await response.json()
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
if (Number(result.status) !== 0) {
throw new Error(`TextMe ${result.status}: ${result.message}`)
}
console.log(result)<?php
// composer require guzzlehttp/guzzle
$client = new \GuzzleHttp\Client([
'headers' => [
'Authorization' => 'Bearer '.getenv('TEXTME_API_TOKEN'),
'Accept' => 'application/json',
],
]);
$response = $client->post('https://my.textme.co.il/api', [
'json' => [
'removeCL' => [
'user' => [
'username' => 'xxxxxx',
],
'cl' => [
'id' => [
'21518',
'21500',
],
],
],
],
]);
$result = json_decode($response->getBody()->getContents(), true);
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
if ((int) $result['status'] !== 0) {
throw new RuntimeException("TextMe {$result['status']}: {$result['message']}");
}
print_r($result);<?php
use Illuminate\Support\Facades\Http;
$result = Http::withToken(config('services.textme.token'))
->acceptJson()
->post('https://my.textme.co.il/api', [
'removeCL' => [
'user' => [
'username' => 'xxxxxx',
],
'cl' => [
'id' => [
'21518',
'21500',
],
],
],
])
->throw()
->json();
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
throw_if((int) $result['status'] !== 0, RuntimeException::class,
"TextMe {$result['status']}: {$result['message']}");
logger()->info('TextMe', $result);# pip install httpx
import os
import httpx
response = httpx.post(
"https://my.textme.co.il/api",
headers={"Authorization": f"Bearer {os.environ['TEXTME_API_TOKEN']}"},
json={
"removeCL": {
"user": {
"username": "xxxxxx",
},
"cl": {
"id": [
"21518",
"21500",
],
},
},
},
)
response.raise_for_status()
result = response.json()
# גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
if int(result["status"]) != 0:
raise RuntimeError(f"TextMe {result['status']}: {result['message']}")
print(result)package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"os"
)
func main() {
payload, _ := json.Marshal(map[string]any{
"removeCL": map[string]any{
"user": map[string]any{
"username": "xxxxxx",
},
"cl": map[string]any{
"id": []any{
"21518",
"21500",
},
},
},
})
req, _ := http.NewRequest("POST", "https://my.textme.co.il/api", bytes.NewReader(payload))
req.Header.Set("Authorization", "Bearer "+os.Getenv("TEXTME_API_TOKEN"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
var result struct {
Status json.Number `json:"status"`
Message string `json:"message"`
}
if err := json.NewDecoder(res.Body).Decode(&result); err != nil {
panic(err)
}
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
if result.Status.String() != "0" {
panic(fmt.Sprintf("TextMe %s: %s", result.Status, result.Message))
}
fmt.Println(result.Message)
}// Java 17+ — java.net.http, ללא תלויות (פענוח עם Jackson/Gson)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class TextMeClRemove {
public static void main(String[] args) throws Exception {
String body = """
{
"removeCL": {
"user": {
"username": "xxxxxx"
},
"cl": {
"id": [
"21518",
"21500"
]
}
}
}
""";
HttpRequest request = HttpRequest.newBuilder(URI.create("https://my.textme.co.il/api"))
.header("Authorization", "Bearer " + System.getenv("TEXTME_API_TOKEN"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
System.out.println(response.body());
}
}// .NET 8+ — System.Net.Http
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
var payload = """
{
"removeCL": {
"user": {
"username": "xxxxxx"
},
"cl": {
"id": [
"21518",
"21500"
]
}
}
}
""";
using var http = new HttpClient();
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(
"Bearer", Environment.GetEnvironmentVariable("TEXTME_API_TOKEN"));
var response = await http.PostAsync("https://my.textme.co.il/api",
new StringContent(payload, Encoding.UTF8, "application/json"));
var result = JsonDocument.Parse(await response.Content.ReadAsStringAsync()).RootElement;
var status = result.GetProperty("status").ToString();
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
if (status != "0")
{
var message = result.GetProperty("message").ToString();
throw new Exception($"TextMe {status}: {message}");
}
Console.WriteLine(result);require "net/http"
require "json"
uri = URI("https://my.textme.co.il/api")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer #{ENV.fetch('TEXTME_API_TOKEN')}"
request["Content-Type"] = "application/json"
request.body = JSON.dump({
"removeCL" => {
"user" => {
"username" => "xxxxxx",
},
"cl" => {
"id" => [
"21518",
"21500",
],
},
},
})
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
result = JSON.parse(response.body)
# גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
raise "TextMe #{result['status']}: #{result['message']}" unless result["status"].to_i.zero?
pp result// [dependencies]
// reqwest = { version = "0.12", features = ["json"] }
// tokio = { version = "1", features = ["full"] }
// serde_json = "1"
use serde_json::{json, Value};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let result: Value = reqwest::Client::new()
.post("https://my.textme.co.il/api")
.bearer_auth(std::env::var("TEXTME_API_TOKEN")?)
.json(&json!({
"removeCL": {
"user": {
"username": "xxxxxx"
},
"cl": {
"id": [
"21518",
"21500"
]
}
}
}))
.send()
.await?
.json()
.await?;
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
if result["status"] != 0 {
return Err(format!("TextMe {}: {}", result["status"], result["message"]).into());
}
println!("{result}");
Ok(())
}תשובה
<?xml version="1.0" encoding="UTF-8"?>
<removeCL>
<status>0</status>
<message>contact list successfully removed</message>
<errors>
<error>contact list id: 21500 does not exist and therefore not removed</error>
</errors>
</removeCL>{
"status": 0,
"message": "conact lists successfully removed",
"errors": [
"contact list id: 21500 does not exist and therefore not removed"
]
}מזהים שאינם קיימים מדווחים ב-errors בעוד השאר מוסרים — הקריאה עדיין עונה 0.
שגיאות
| Status | מתי |
|---|---|
2 | חסר cl או id. |
988 | Contact list are entered not exist. |
511 | החשבון אינו רשאי לבצע את הפעולה. |
addNumCL הוספת מספרים לרשימה
פרמטרים
| שם | סוג | תיאור | חובה |
|---|---|---|---|
addNumCL | object | מכיל את כל האלמנטים האחרים. | ✔️ |
user | object | מכיל את אלמנט המשתמש. | ✔️ |
username | string | שם המשתמש של החשבון שבו אתם מזוהים במערכת. | ✔️ |
cl | object | הרשימה לעדכון. חזרתי — כמה רשימות בקריאה אחת. | ✔️ |
cl.id | int | מזהה רשימת התפוצה לעדכון. | ✔️ |
destinations | object | מכיל את כל המספרים להוספה לרשימה הזו. | ✔️ |
destination | object | איש קשר אחד. חזרתי. | ✔️ |
phone | int | מספר איש הקשר, בפורמט 5xxxxxxx או 05xxxxxxx. | ✔️ |
df1 … df6 | string | שדות דינמיים לאיש הקשר הזה ברשימה הזו. | ➖ |
דוגמת בקשה
<?xml version="1.0" encoding="UTF-8"?>
<addNumCL>
<user>
<username>xxxxxx</username>
</user>
<cl>
<id>21518</id>
<destinations>
<destination>
<phone>055XXXXXXX</phone>
<df1>Israel</df1>
<df2>Israeli</df2>
<df3>Haifa</df3>
</destination>
<destination>
<phone>55XXXXXXX</phone>
</destination>
</destinations>
</cl>
<cl>
<id>21500</id>
<destinations>
<destination>
<phone>055XXXXXXX</phone>
</destination>
</destinations>
</cl>
</addNumCL>{
"addNumCL": {
"user": {
"username": "xxxxxx"
},
"cl": [
{
"id": "21518",
"destinations": {
"destination": [
{
"phone": "055XXXXXXX",
"df1": "Israel",
"df2": "Israeli",
"df3": "Haifa"
},
{
"phone": "55XXXXXXX"
}
]
}
},
{
"id": "21500",
"destinations": {
"destination": [
{
"phone": "055XXXXXXX"
}
]
}
}
]
}
}curl --location 'https://my.textme.co.il/api' \
--header "Authorization: Bearer $TEXTME_API_TOKEN" \
--header 'Content-Type: application/json' \
--data '{
"addNumCL": {
"user": {
"username": "xxxxxx"
},
"cl": [
{
"id": "21518",
"destinations": {
"destination": [
{
"phone": "055XXXXXXX",
"df1": "Israel",
"df2": "Israeli",
"df3": "Haifa"
},
{
"phone": "55XXXXXXX"
}
]
}
},
{
"id": "21500",
"destinations": {
"destination": [
{
"phone": "055XXXXXXX"
}
]
}
}
]
}
}'// Node.js 18+ / דפדפנים — ללא תלויות
const response = await fetch('https://my.textme.co.il/api', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.TEXTME_API_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
addNumCL: {
user: {
username: 'xxxxxx',
},
cl: [
{
id: '21518',
destinations: {
destination: [
{
phone: '055XXXXXXX',
df1: 'Israel',
df2: 'Israeli',
df3: 'Haifa',
},
{
phone: '55XXXXXXX',
},
],
},
},
{
id: '21500',
destinations: {
destination: [
{
phone: '055XXXXXXX',
},
],
},
},
],
},
}),
})
const result = await response.json()
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
if (Number(result.status) !== 0) {
throw new Error(`TextMe ${result.status}: ${result.message}`)
}
console.log(result)<?php
// composer require guzzlehttp/guzzle
$client = new \GuzzleHttp\Client([
'headers' => [
'Authorization' => 'Bearer '.getenv('TEXTME_API_TOKEN'),
'Accept' => 'application/json',
],
]);
$response = $client->post('https://my.textme.co.il/api', [
'json' => [
'addNumCL' => [
'user' => [
'username' => 'xxxxxx',
],
'cl' => [
[
'id' => '21518',
'destinations' => [
'destination' => [
[
'phone' => '055XXXXXXX',
'df1' => 'Israel',
'df2' => 'Israeli',
'df3' => 'Haifa',
],
[
'phone' => '55XXXXXXX',
],
],
],
],
[
'id' => '21500',
'destinations' => [
'destination' => [
[
'phone' => '055XXXXXXX',
],
],
],
],
],
],
],
]);
$result = json_decode($response->getBody()->getContents(), true);
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
if ((int) $result['status'] !== 0) {
throw new RuntimeException("TextMe {$result['status']}: {$result['message']}");
}
print_r($result);<?php
use Illuminate\Support\Facades\Http;
$result = Http::withToken(config('services.textme.token'))
->acceptJson()
->post('https://my.textme.co.il/api', [
'addNumCL' => [
'user' => [
'username' => 'xxxxxx',
],
'cl' => [
[
'id' => '21518',
'destinations' => [
'destination' => [
[
'phone' => '055XXXXXXX',
'df1' => 'Israel',
'df2' => 'Israeli',
'df3' => 'Haifa',
],
[
'phone' => '55XXXXXXX',
],
],
],
],
[
'id' => '21500',
'destinations' => [
'destination' => [
[
'phone' => '055XXXXXXX',
],
],
],
],
],
],
])
->throw()
->json();
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
throw_if((int) $result['status'] !== 0, RuntimeException::class,
"TextMe {$result['status']}: {$result['message']}");
logger()->info('TextMe', $result);# pip install httpx
import os
import httpx
response = httpx.post(
"https://my.textme.co.il/api",
headers={"Authorization": f"Bearer {os.environ['TEXTME_API_TOKEN']}"},
json={
"addNumCL": {
"user": {
"username": "xxxxxx",
},
"cl": [
{
"id": "21518",
"destinations": {
"destination": [
{
"phone": "055XXXXXXX",
"df1": "Israel",
"df2": "Israeli",
"df3": "Haifa",
},
{
"phone": "55XXXXXXX",
},
],
},
},
{
"id": "21500",
"destinations": {
"destination": [
{
"phone": "055XXXXXXX",
},
],
},
},
],
},
},
)
response.raise_for_status()
result = response.json()
# גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
if int(result["status"]) != 0:
raise RuntimeError(f"TextMe {result['status']}: {result['message']}")
print(result)package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"os"
)
func main() {
payload, _ := json.Marshal(map[string]any{
"addNumCL": map[string]any{
"user": map[string]any{
"username": "xxxxxx",
},
"cl": []any{
map[string]any{
"id": "21518",
"destinations": map[string]any{
"destination": []any{
map[string]any{
"phone": "055XXXXXXX",
"df1": "Israel",
"df2": "Israeli",
"df3": "Haifa",
},
map[string]any{
"phone": "55XXXXXXX",
},
},
},
},
map[string]any{
"id": "21500",
"destinations": map[string]any{
"destination": []any{
map[string]any{
"phone": "055XXXXXXX",
},
},
},
},
},
},
})
req, _ := http.NewRequest("POST", "https://my.textme.co.il/api", bytes.NewReader(payload))
req.Header.Set("Authorization", "Bearer "+os.Getenv("TEXTME_API_TOKEN"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
var result struct {
Status json.Number `json:"status"`
Message string `json:"message"`
}
if err := json.NewDecoder(res.Body).Decode(&result); err != nil {
panic(err)
}
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
if result.Status.String() != "0" {
panic(fmt.Sprintf("TextMe %s: %s", result.Status, result.Message))
}
fmt.Println(result.Message)
}// Java 17+ — java.net.http, ללא תלויות (פענוח עם Jackson/Gson)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class TextMeClAddNumbers {
public static void main(String[] args) throws Exception {
String body = """
{
"addNumCL": {
"user": {
"username": "xxxxxx"
},
"cl": [
{
"id": "21518",
"destinations": {
"destination": [
{
"phone": "055XXXXXXX",
"df1": "Israel",
"df2": "Israeli",
"df3": "Haifa"
},
{
"phone": "55XXXXXXX"
}
]
}
},
{
"id": "21500",
"destinations": {
"destination": [
{
"phone": "055XXXXXXX"
}
]
}
}
]
}
}
""";
HttpRequest request = HttpRequest.newBuilder(URI.create("https://my.textme.co.il/api"))
.header("Authorization", "Bearer " + System.getenv("TEXTME_API_TOKEN"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
System.out.println(response.body());
}
}// .NET 8+ — System.Net.Http
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
var payload = """
{
"addNumCL": {
"user": {
"username": "xxxxxx"
},
"cl": [
{
"id": "21518",
"destinations": {
"destination": [
{
"phone": "055XXXXXXX",
"df1": "Israel",
"df2": "Israeli",
"df3": "Haifa"
},
{
"phone": "55XXXXXXX"
}
]
}
},
{
"id": "21500",
"destinations": {
"destination": [
{
"phone": "055XXXXXXX"
}
]
}
}
]
}
}
""";
using var http = new HttpClient();
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(
"Bearer", Environment.GetEnvironmentVariable("TEXTME_API_TOKEN"));
var response = await http.PostAsync("https://my.textme.co.il/api",
new StringContent(payload, Encoding.UTF8, "application/json"));
var result = JsonDocument.Parse(await response.Content.ReadAsStringAsync()).RootElement;
var status = result.GetProperty("status").ToString();
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
if (status != "0")
{
var message = result.GetProperty("message").ToString();
throw new Exception($"TextMe {status}: {message}");
}
Console.WriteLine(result);require "net/http"
require "json"
uri = URI("https://my.textme.co.il/api")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer #{ENV.fetch('TEXTME_API_TOKEN')}"
request["Content-Type"] = "application/json"
request.body = JSON.dump({
"addNumCL" => {
"user" => {
"username" => "xxxxxx",
},
"cl" => [
{
"id" => "21518",
"destinations" => {
"destination" => [
{
"phone" => "055XXXXXXX",
"df1" => "Israel",
"df2" => "Israeli",
"df3" => "Haifa",
},
{
"phone" => "55XXXXXXX",
},
],
},
},
{
"id" => "21500",
"destinations" => {
"destination" => [
{
"phone" => "055XXXXXXX",
},
],
},
},
],
},
})
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
result = JSON.parse(response.body)
# גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
raise "TextMe #{result['status']}: #{result['message']}" unless result["status"].to_i.zero?
pp result// [dependencies]
// reqwest = { version = "0.12", features = ["json"] }
// tokio = { version = "1", features = ["full"] }
// serde_json = "1"
use serde_json::{json, Value};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let result: Value = reqwest::Client::new()
.post("https://my.textme.co.il/api")
.bearer_auth(std::env::var("TEXTME_API_TOKEN")?)
.json(&json!({
"addNumCL": {
"user": {
"username": "xxxxxx"
},
"cl": [
{
"id": "21518",
"destinations": {
"destination": [
{
"phone": "055XXXXXXX",
"df1": "Israel",
"df2": "Israeli",
"df3": "Haifa"
},
{
"phone": "55XXXXXXX"
}
]
}
},
{
"id": "21500",
"destinations": {
"destination": [
{
"phone": "055XXXXXXX"
}
]
}
}
]
}
}))
.send()
.await?
.json()
.await?;
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
if result["status"] != 0 {
return Err(format!("TextMe {}: {}", result["status"], result["message"]).into());
}
println!("{result}");
Ok(())
}תשובה
<?xml version="1.0" encoding="utf-8"?>
<sms>
<status>0</status>
<message>The phone numbers have been added successfully</message>
<errors>
<error>The phone 055XXXXXXX is already on the contact list and therefore not added</error>
</errors>
</sms>{
"status": 0,
"message": "The phone numbers have been added successfully",
"errors": [
"The phone 05XXXXXXXX is already on the contact list and therefore not added"
]
}מספרים שכבר ברשימה מדווחים ב-errors ומדולגים — כך שההוספה אידמפוטנטית בפועל לכל מספר.
שגיאות
| Status | מתי |
|---|---|
2 | חסר cl, id או destinations. |
988 | רשימת התפוצה אינה קיימת. |
511 | החשבון אינו רשאי לבצע את הפעולה. |
rmNumCL הסרת מספרים מרשימה
שימו לב להבדל במבנה: כאן destinations מחזיק אלמנטי phone ישירות, בלי עוטף destination.
פרמטרים
| שם | סוג | תיאור | חובה |
|---|---|---|---|
rmNumCL | object | מכיל את כל האלמנטים האחרים. | ✔️ |
user | object | מכיל את אלמנט המשתמש. | ✔️ |
username | string | שם המשתמש של החשבון שבו אתם מזוהים במערכת. | ✔️ |
cl | object | הרשימה לעדכון. חזרתי. | ✔️ |
cl.id | int | מזהה רשימת התפוצה לעדכון. | ✔️ |
destinations | object | מכיל את המספרים להסרה מהרשימה הזו. | ✔️ |
phone | int | מספר להסרה, בפורמט 5xxxxxxx או 05xxxxxxx. חזרתי. | ✔️ |
דוגמת בקשה
<?xml version="1.0" encoding="UTF-8"?>
<rmNumCL>
<user>
<username>xxxxxx</username>
</user>
<cl>
<id>21518</id>
<destinations>
<phone>055XXXXXXX</phone>
</destinations>
</cl>
<cl>
<id>21500</id>
<destinations>
<phone>055XXXXXXX</phone>
<phone>55XXXXXXX</phone>
</destinations>
</cl>
</rmNumCL>{
"rmNumCL": {
"user": {
"username": "xxxxxx"
},
"cl": [
{
"id": "21518",
"destinations": {
"phone": "055XXXXXXX"
}
},
{
"id": "21500",
"destinations": {
"phone": [
"055XXXXXXX",
"55XXXXXXX"
]
}
}
]
}
}curl --location 'https://my.textme.co.il/api' \
--header "Authorization: Bearer $TEXTME_API_TOKEN" \
--header 'Content-Type: application/json' \
--data '{
"rmNumCL": {
"user": {
"username": "xxxxxx"
},
"cl": [
{
"id": "21518",
"destinations": {
"phone": "055XXXXXXX"
}
},
{
"id": "21500",
"destinations": {
"phone": [
"055XXXXXXX",
"55XXXXXXX"
]
}
}
]
}
}'// Node.js 18+ / דפדפנים — ללא תלויות
const response = await fetch('https://my.textme.co.il/api', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.TEXTME_API_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
rmNumCL: {
user: {
username: 'xxxxxx',
},
cl: [
{
id: '21518',
destinations: {
phone: '055XXXXXXX',
},
},
{
id: '21500',
destinations: {
phone: [
'055XXXXXXX',
'55XXXXXXX',
],
},
},
],
},
}),
})
const result = await response.json()
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
if (Number(result.status) !== 0) {
throw new Error(`TextMe ${result.status}: ${result.message}`)
}
console.log(result)<?php
// composer require guzzlehttp/guzzle
$client = new \GuzzleHttp\Client([
'headers' => [
'Authorization' => 'Bearer '.getenv('TEXTME_API_TOKEN'),
'Accept' => 'application/json',
],
]);
$response = $client->post('https://my.textme.co.il/api', [
'json' => [
'rmNumCL' => [
'user' => [
'username' => 'xxxxxx',
],
'cl' => [
[
'id' => '21518',
'destinations' => [
'phone' => '055XXXXXXX',
],
],
[
'id' => '21500',
'destinations' => [
'phone' => [
'055XXXXXXX',
'55XXXXXXX',
],
],
],
],
],
],
]);
$result = json_decode($response->getBody()->getContents(), true);
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
if ((int) $result['status'] !== 0) {
throw new RuntimeException("TextMe {$result['status']}: {$result['message']}");
}
print_r($result);<?php
use Illuminate\Support\Facades\Http;
$result = Http::withToken(config('services.textme.token'))
->acceptJson()
->post('https://my.textme.co.il/api', [
'rmNumCL' => [
'user' => [
'username' => 'xxxxxx',
],
'cl' => [
[
'id' => '21518',
'destinations' => [
'phone' => '055XXXXXXX',
],
],
[
'id' => '21500',
'destinations' => [
'phone' => [
'055XXXXXXX',
'55XXXXXXX',
],
],
],
],
],
])
->throw()
->json();
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
throw_if((int) $result['status'] !== 0, RuntimeException::class,
"TextMe {$result['status']}: {$result['message']}");
logger()->info('TextMe', $result);# pip install httpx
import os
import httpx
response = httpx.post(
"https://my.textme.co.il/api",
headers={"Authorization": f"Bearer {os.environ['TEXTME_API_TOKEN']}"},
json={
"rmNumCL": {
"user": {
"username": "xxxxxx",
},
"cl": [
{
"id": "21518",
"destinations": {
"phone": "055XXXXXXX",
},
},
{
"id": "21500",
"destinations": {
"phone": [
"055XXXXXXX",
"55XXXXXXX",
],
},
},
],
},
},
)
response.raise_for_status()
result = response.json()
# גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
if int(result["status"]) != 0:
raise RuntimeError(f"TextMe {result['status']}: {result['message']}")
print(result)package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"os"
)
func main() {
payload, _ := json.Marshal(map[string]any{
"rmNumCL": map[string]any{
"user": map[string]any{
"username": "xxxxxx",
},
"cl": []any{
map[string]any{
"id": "21518",
"destinations": map[string]any{
"phone": "055XXXXXXX",
},
},
map[string]any{
"id": "21500",
"destinations": map[string]any{
"phone": []any{
"055XXXXXXX",
"55XXXXXXX",
},
},
},
},
},
})
req, _ := http.NewRequest("POST", "https://my.textme.co.il/api", bytes.NewReader(payload))
req.Header.Set("Authorization", "Bearer "+os.Getenv("TEXTME_API_TOKEN"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
var result struct {
Status json.Number `json:"status"`
Message string `json:"message"`
}
if err := json.NewDecoder(res.Body).Decode(&result); err != nil {
panic(err)
}
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
if result.Status.String() != "0" {
panic(fmt.Sprintf("TextMe %s: %s", result.Status, result.Message))
}
fmt.Println(result.Message)
}// Java 17+ — java.net.http, ללא תלויות (פענוח עם Jackson/Gson)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class TextMeClRemoveNumbers {
public static void main(String[] args) throws Exception {
String body = """
{
"rmNumCL": {
"user": {
"username": "xxxxxx"
},
"cl": [
{
"id": "21518",
"destinations": {
"phone": "055XXXXXXX"
}
},
{
"id": "21500",
"destinations": {
"phone": [
"055XXXXXXX",
"55XXXXXXX"
]
}
}
]
}
}
""";
HttpRequest request = HttpRequest.newBuilder(URI.create("https://my.textme.co.il/api"))
.header("Authorization", "Bearer " + System.getenv("TEXTME_API_TOKEN"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
System.out.println(response.body());
}
}// .NET 8+ — System.Net.Http
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
var payload = """
{
"rmNumCL": {
"user": {
"username": "xxxxxx"
},
"cl": [
{
"id": "21518",
"destinations": {
"phone": "055XXXXXXX"
}
},
{
"id": "21500",
"destinations": {
"phone": [
"055XXXXXXX",
"55XXXXXXX"
]
}
}
]
}
}
""";
using var http = new HttpClient();
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(
"Bearer", Environment.GetEnvironmentVariable("TEXTME_API_TOKEN"));
var response = await http.PostAsync("https://my.textme.co.il/api",
new StringContent(payload, Encoding.UTF8, "application/json"));
var result = JsonDocument.Parse(await response.Content.ReadAsStringAsync()).RootElement;
var status = result.GetProperty("status").ToString();
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
if (status != "0")
{
var message = result.GetProperty("message").ToString();
throw new Exception($"TextMe {status}: {message}");
}
Console.WriteLine(result);require "net/http"
require "json"
uri = URI("https://my.textme.co.il/api")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer #{ENV.fetch('TEXTME_API_TOKEN')}"
request["Content-Type"] = "application/json"
request.body = JSON.dump({
"rmNumCL" => {
"user" => {
"username" => "xxxxxx",
},
"cl" => [
{
"id" => "21518",
"destinations" => {
"phone" => "055XXXXXXX",
},
},
{
"id" => "21500",
"destinations" => {
"phone" => [
"055XXXXXXX",
"55XXXXXXX",
],
},
},
],
},
})
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
result = JSON.parse(response.body)
# גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
raise "TextMe #{result['status']}: #{result['message']}" unless result["status"].to_i.zero?
pp result// [dependencies]
// reqwest = { version = "0.12", features = ["json"] }
// tokio = { version = "1", features = ["full"] }
// serde_json = "1"
use serde_json::{json, Value};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let result: Value = reqwest::Client::new()
.post("https://my.textme.co.il/api")
.bearer_auth(std::env::var("TEXTME_API_TOKEN")?)
.json(&json!({
"rmNumCL": {
"user": {
"username": "xxxxxx"
},
"cl": [
{
"id": "21518",
"destinations": {
"phone": "055XXXXXXX"
}
},
{
"id": "21500",
"destinations": {
"phone": [
"055XXXXXXX",
"55XXXXXXX"
]
}
}
]
}
}))
.send()
.await?
.json()
.await?;
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
if result["status"] != 0 {
return Err(format!("TextMe {}: {}", result["status"], result["message"]).into());
}
println!("{result}");
Ok(())
}תשובה
<?xml version="1.0" encoding="UTF-8"?>
<rmNumCL>
<status>0</status>
<message>Successfully deleted phone numbers</message>
<errors>
<error>contact list id: 21500 does not exist and therefore not removed</error>
</errors>
</rmNumCL>{
"status": 0,
"message": "Successfully deleted phone numbers",
"errors": [
"contact list id: 21500 does not exist and therefore not removed"
]
}שגיאות
| Status | מתי |
|---|---|
2 | חסר cl, id או destinations. |
988 | רשימת התפוצה אינה קיימת. |
511 | החשבון אינו רשאי לבצע את הפעולה. |
getCL רשימת כל רשימות התפוצה
מחזירה כל רשימה בחשבון, כולל ריקות, כרצף שטוח של שורות.
פרמטרים
| שם | סוג | תיאור | חובה |
|---|---|---|---|
getCL | object | מכיל את כל האלמנטים האחרים. | ✔️ |
user | object | מכיל את אלמנט המשתמש. | ✔️ |
username | string | שם המשתמש של החשבון שבו אתם מזוהים במערכת. | ✔️ |
דוגמת בקשה
<?xml version="1.0" encoding="UTF-8"?>
<getCL>
<user>
<username>xxxxxx</username>
</user>
</getCL>{
"getCL": {
"user": {
"username": "xxxxxx"
}
}
}curl --location 'https://my.textme.co.il/api' \
--header "Authorization: Bearer $TEXTME_API_TOKEN" \
--header 'Content-Type: application/json' \
--data '{
"getCL": {
"user": {
"username": "xxxxxx"
}
}
}'// Node.js 18+ / דפדפנים — ללא תלויות
const response = await fetch('https://my.textme.co.il/api', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.TEXTME_API_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
getCL: {
user: {
username: 'xxxxxx',
},
},
}),
})
const result = await response.json()
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
if (Number(result.status) !== 0) {
throw new Error(`TextMe ${result.status}: ${result.message}`)
}
console.log(result)<?php
// composer require guzzlehttp/guzzle
$client = new \GuzzleHttp\Client([
'headers' => [
'Authorization' => 'Bearer '.getenv('TEXTME_API_TOKEN'),
'Accept' => 'application/json',
],
]);
$response = $client->post('https://my.textme.co.il/api', [
'json' => [
'getCL' => [
'user' => [
'username' => 'xxxxxx',
],
],
],
]);
$result = json_decode($response->getBody()->getContents(), true);
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
if ((int) $result['status'] !== 0) {
throw new RuntimeException("TextMe {$result['status']}: {$result['message']}");
}
print_r($result);<?php
use Illuminate\Support\Facades\Http;
$result = Http::withToken(config('services.textme.token'))
->acceptJson()
->post('https://my.textme.co.il/api', [
'getCL' => [
'user' => [
'username' => 'xxxxxx',
],
],
])
->throw()
->json();
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
throw_if((int) $result['status'] !== 0, RuntimeException::class,
"TextMe {$result['status']}: {$result['message']}");
logger()->info('TextMe', $result);# pip install httpx
import os
import httpx
response = httpx.post(
"https://my.textme.co.il/api",
headers={"Authorization": f"Bearer {os.environ['TEXTME_API_TOKEN']}"},
json={
"getCL": {
"user": {
"username": "xxxxxx",
},
},
},
)
response.raise_for_status()
result = response.json()
# גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
if int(result["status"]) != 0:
raise RuntimeError(f"TextMe {result['status']}: {result['message']}")
print(result)package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"os"
)
func main() {
payload, _ := json.Marshal(map[string]any{
"getCL": map[string]any{
"user": map[string]any{
"username": "xxxxxx",
},
},
})
req, _ := http.NewRequest("POST", "https://my.textme.co.il/api", bytes.NewReader(payload))
req.Header.Set("Authorization", "Bearer "+os.Getenv("TEXTME_API_TOKEN"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
var result struct {
Status json.Number `json:"status"`
Message string `json:"message"`
}
if err := json.NewDecoder(res.Body).Decode(&result); err != nil {
panic(err)
}
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
if result.Status.String() != "0" {
panic(fmt.Sprintf("TextMe %s: %s", result.Status, result.Message))
}
fmt.Println(result.Message)
}// Java 17+ — java.net.http, ללא תלויות (פענוח עם Jackson/Gson)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class TextMeClGetAll {
public static void main(String[] args) throws Exception {
String body = """
{
"getCL": {
"user": {
"username": "xxxxxx"
}
}
}
""";
HttpRequest request = HttpRequest.newBuilder(URI.create("https://my.textme.co.il/api"))
.header("Authorization", "Bearer " + System.getenv("TEXTME_API_TOKEN"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
System.out.println(response.body());
}
}// .NET 8+ — System.Net.Http
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
var payload = """
{
"getCL": {
"user": {
"username": "xxxxxx"
}
}
}
""";
using var http = new HttpClient();
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(
"Bearer", Environment.GetEnvironmentVariable("TEXTME_API_TOKEN"));
var response = await http.PostAsync("https://my.textme.co.il/api",
new StringContent(payload, Encoding.UTF8, "application/json"));
var result = JsonDocument.Parse(await response.Content.ReadAsStringAsync()).RootElement;
var status = result.GetProperty("status").ToString();
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
if (status != "0")
{
var message = result.GetProperty("message").ToString();
throw new Exception($"TextMe {status}: {message}");
}
Console.WriteLine(result);require "net/http"
require "json"
uri = URI("https://my.textme.co.il/api")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer #{ENV.fetch('TEXTME_API_TOKEN')}"
request["Content-Type"] = "application/json"
request.body = JSON.dump({
"getCL" => {
"user" => {
"username" => "xxxxxx",
},
},
})
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
result = JSON.parse(response.body)
# גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
raise "TextMe #{result['status']}: #{result['message']}" unless result["status"].to_i.zero?
pp result// [dependencies]
// reqwest = { version = "0.12", features = ["json"] }
// tokio = { version = "1", features = ["full"] }
// serde_json = "1"
use serde_json::{json, Value};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let result: Value = reqwest::Client::new()
.post("https://my.textme.co.il/api")
.bearer_auth(std::env::var("TEXTME_API_TOKEN")?)
.json(&json!({
"getCL": {
"user": {
"username": "xxxxxx"
}
}
}))
.send()
.await?
.json()
.await?;
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
if result["status"] != 0 {
return Err(format!("TextMe {}: {}", result["status"], result["message"]).into());
}
println!("{result}");
Ok(())
}תשובה
<?xml version="1.0" encoding="UTF-8"?>
<getCL>
<status>0</status>
<message></message>
<contact_lists>
<contact_list>
<cl_id>21518</cl_id>
<phone>55XXXXXXX</phone>
<name>name1</name>
</contact_list>
<contact_list>
<cl_id>21500</cl_id>
<phone>055XXXXXXX</phone>
<name>name2</name>
</contact_list>
</contact_lists>
</getCL>{
"status": 0,
"message": "",
"contact_lists": [
{
"cl_id": "21518",
"phone": "55XXXXXXX",
"name": "name1"
},
{
"cl_id": "21500",
"phone": "555XXXXXX",
"name": "name2"
}
]
}| שדה | סוג | תיאור |
|---|---|---|
contact_lists | array | שורה אחת לכל איש קשר, לא לכל רשימה. |
contact_lists[].cl_id | string | הרשימה שאיש הקשר שייך אליה. |
contact_lists[].phone | string | מספר איש הקשר. |
contact_lists[].name | string | שם הרשימה, חוזר בכל שורה. |
התשובה היא שורות, לא רשימות
רשימה עם שלושה אנשי קשר מייצרת שלוש שורות שנושאות אותו cl_id ואותו name. קבצו לפי cl_id כדי לשחזר את הרשימות — וצפו לכך שהתשובה תגדל עם מספר אנשי הקשר, לא מספר הרשימות.
שגיאות
| Status | מתי |
|---|---|
3, 10, 11 | טוקן לא תקף, פג תוקף, או שייך ל-username אחר. |
511 | החשבון אינו רשאי לבצע את הפעולה. |
getCLbyID קריאת רשימת תפוצה אחת
פרמטרים
| שם | סוג | תיאור | חובה |
|---|---|---|---|
getCLbyID | object | מכיל את כל האלמנטים האחרים. | ✔️ |
user | object | מכיל את אלמנט המשתמש. | ✔️ |
username | string | שם המשתמש של החשבון שבו אתם מזוהים במערכת. | ✔️ |
cl | object | מכיל את אלמנטי רשימת התפוצה. | ✔️ |
id | int | מזהה רשימת התפוצה שאתם רוצים. | ✔️ |
דוגמת בקשה
<?xml version="1.0" encoding="UTF-8"?>
<getCLbyID>
<user>
<username>xxxxxx</username>
</user>
<cl>
<id>21518</id>
</cl>
</getCLbyID>{
"getCLbyID": {
"user": {
"username": "xxxxxx"
},
"cl": {
"id": "21518"
}
}
}curl --location 'https://my.textme.co.il/api' \
--header "Authorization: Bearer $TEXTME_API_TOKEN" \
--header 'Content-Type: application/json' \
--data '{
"getCLbyID": {
"user": {
"username": "xxxxxx"
},
"cl": {
"id": "21518"
}
}
}'// Node.js 18+ / דפדפנים — ללא תלויות
const response = await fetch('https://my.textme.co.il/api', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.TEXTME_API_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
getCLbyID: {
user: {
username: 'xxxxxx',
},
cl: {
id: '21518',
},
},
}),
})
const result = await response.json()
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
if (Number(result.status) !== 0) {
throw new Error(`TextMe ${result.status}: ${result.message}`)
}
console.log(result)<?php
// composer require guzzlehttp/guzzle
$client = new \GuzzleHttp\Client([
'headers' => [
'Authorization' => 'Bearer '.getenv('TEXTME_API_TOKEN'),
'Accept' => 'application/json',
],
]);
$response = $client->post('https://my.textme.co.il/api', [
'json' => [
'getCLbyID' => [
'user' => [
'username' => 'xxxxxx',
],
'cl' => [
'id' => '21518',
],
],
],
]);
$result = json_decode($response->getBody()->getContents(), true);
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
if ((int) $result['status'] !== 0) {
throw new RuntimeException("TextMe {$result['status']}: {$result['message']}");
}
print_r($result);<?php
use Illuminate\Support\Facades\Http;
$result = Http::withToken(config('services.textme.token'))
->acceptJson()
->post('https://my.textme.co.il/api', [
'getCLbyID' => [
'user' => [
'username' => 'xxxxxx',
],
'cl' => [
'id' => '21518',
],
],
])
->throw()
->json();
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
throw_if((int) $result['status'] !== 0, RuntimeException::class,
"TextMe {$result['status']}: {$result['message']}");
logger()->info('TextMe', $result);# pip install httpx
import os
import httpx
response = httpx.post(
"https://my.textme.co.il/api",
headers={"Authorization": f"Bearer {os.environ['TEXTME_API_TOKEN']}"},
json={
"getCLbyID": {
"user": {
"username": "xxxxxx",
},
"cl": {
"id": "21518",
},
},
},
)
response.raise_for_status()
result = response.json()
# גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
if int(result["status"]) != 0:
raise RuntimeError(f"TextMe {result['status']}: {result['message']}")
print(result)package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"os"
)
func main() {
payload, _ := json.Marshal(map[string]any{
"getCLbyID": map[string]any{
"user": map[string]any{
"username": "xxxxxx",
},
"cl": map[string]any{
"id": "21518",
},
},
})
req, _ := http.NewRequest("POST", "https://my.textme.co.il/api", bytes.NewReader(payload))
req.Header.Set("Authorization", "Bearer "+os.Getenv("TEXTME_API_TOKEN"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
var result struct {
Status json.Number `json:"status"`
Message string `json:"message"`
}
if err := json.NewDecoder(res.Body).Decode(&result); err != nil {
panic(err)
}
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
if result.Status.String() != "0" {
panic(fmt.Sprintf("TextMe %s: %s", result.Status, result.Message))
}
fmt.Println(result.Message)
}// Java 17+ — java.net.http, ללא תלויות (פענוח עם Jackson/Gson)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class TextMeClGetById {
public static void main(String[] args) throws Exception {
String body = """
{
"getCLbyID": {
"user": {
"username": "xxxxxx"
},
"cl": {
"id": "21518"
}
}
}
""";
HttpRequest request = HttpRequest.newBuilder(URI.create("https://my.textme.co.il/api"))
.header("Authorization", "Bearer " + System.getenv("TEXTME_API_TOKEN"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
System.out.println(response.body());
}
}// .NET 8+ — System.Net.Http
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
var payload = """
{
"getCLbyID": {
"user": {
"username": "xxxxxx"
},
"cl": {
"id": "21518"
}
}
}
""";
using var http = new HttpClient();
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(
"Bearer", Environment.GetEnvironmentVariable("TEXTME_API_TOKEN"));
var response = await http.PostAsync("https://my.textme.co.il/api",
new StringContent(payload, Encoding.UTF8, "application/json"));
var result = JsonDocument.Parse(await response.Content.ReadAsStringAsync()).RootElement;
var status = result.GetProperty("status").ToString();
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
if (status != "0")
{
var message = result.GetProperty("message").ToString();
throw new Exception($"TextMe {status}: {message}");
}
Console.WriteLine(result);require "net/http"
require "json"
uri = URI("https://my.textme.co.il/api")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer #{ENV.fetch('TEXTME_API_TOKEN')}"
request["Content-Type"] = "application/json"
request.body = JSON.dump({
"getCLbyID" => {
"user" => {
"username" => "xxxxxx",
},
"cl" => {
"id" => "21518",
},
},
})
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
result = JSON.parse(response.body)
# גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
raise "TextMe #{result['status']}: #{result['message']}" unless result["status"].to_i.zero?
pp result// [dependencies]
// reqwest = { version = "0.12", features = ["json"] }
// tokio = { version = "1", features = ["full"] }
// serde_json = "1"
use serde_json::{json, Value};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let result: Value = reqwest::Client::new()
.post("https://my.textme.co.il/api")
.bearer_auth(std::env::var("TEXTME_API_TOKEN")?)
.json(&json!({
"getCLbyID": {
"user": {
"username": "xxxxxx"
},
"cl": {
"id": "21518"
}
}
}))
.send()
.await?
.json()
.await?;
// גם שגיאה חוזרת כ-HTTP 200 — הסטטוס שבגוף התשובה הוא הקובע
if result["status"] != 0 {
return Err(format!("TextMe {}: {}", result["status"], result["message"]).into());
}
println!("{result}");
Ok(())
}תשובה
<?xml version="1.0" encoding="UTF-8"?>
<getCLbyID>
<status>0</status>
<message></message>
<contact_lists>
<contact_list>
<phone>55XXXXXXX</phone>
<name>name1</name>
</contact_list>
</contact_lists>
</getCLbyID>{
"status": 0,
"message": "",
"contact_lists": [
{
"cl_id": "21518",
"phone": "55XXXXXXX",
"name": "name1"
},
{
"cl_id": "21518",
"phone": "555XXXXXX",
"name": "name1"
}
]
}אותו מבנה שורות כמו getCL, מצומצם לרשימה אחת.
שגיאות
| Status | מתי |
|---|---|
2 | חסר cl או id. |
988 | רשימת התפוצה אינה קיימת. |
511 | החשבון אינו רשאי לבצע את הפעולה. |
הערות על השדות
שדות דינמיים
כל איש קשר יכול לשאת שישה ערכים, df1 עד df6. בגוף ההודעה מפנים אליהם לפי מקום:
Hello [DYNAMIC_FIELD1] [DYNAMIC_FIELD2], your parcel is on its way to [DYNAMIC_FIELD3].עם df1 = Israel, df2 = Israeli, df3 = Haifa, זה מגיע כ-Hello Israel Israeli, your parcel is on its way to Haifa.
כדי להשתמש בהם, sms צריכה add_dynamic בערך 1, cl_id אחד בדיוק, ואף אלמנט phone בודד — ערכי המיזוג חייבים לבוא מרשימה אחת. הסבר מלא בעבודה עם רשימות תפוצה.
שדות דינמיים שייכים לחברות ברשימה, לא לאיש הקשר
אותו מספר בשתי רשימות יכול לשאת ערכים שונים בכל אחת, כי df1–df6 נשמרים לכל שורה. זה שימושי — לקוח יכול להיות "ישראל" ברשימה בעברית ו-"מר ישראלי" ברשימה הפורמלית — וזו גם מלכודת: עדכון ערך פירושו עדכון בכל רשימה שהמספר מופיע בה.
הקריאה יקרה, הכתיבה זולה
getCL מחזירה שורה לכל איש קשר בכל החשבון. בחשבון עם רשימות גדולות זה נפח גדול עבור שאלה שהיא בדרך כלל קטנה. שמרו את ה-cl_id שקיבלתם מ-newCL בזמן היצירה ולא תצטרכו אותה כמעט לעולם.
אין פעולת עדכון
כדי לשנות שדות דינמיים של איש קשר, הסירו את המספר עם rmNumCL והוסיפו אותו מחדש עם addNumCL וערכים חדשים. הוספת מספר שכבר קיים נדחית ברמת השורה ולא נחשבת עדכון.

