Subscribe user
Add a mobile number to a campaign's subscriber list, or remove it, with the legacy HTTP API (SubscribeUser.aspx).
https://mzone.wire2air.com/mserver/api/SubscribeUser.aspxOnly add people who have agreed to receive your messages.
Parameters
| Parameter | In | Description |
|---|---|---|
| APPKEY stringrequired in body | body | Your app key. See authentication. |
| SHORTCODE stringrequired in body | body | The campaign's short code. |
| MOBILE NUMBER stringrequired in body | body | The subscriber's mobile number. See the note below about this parameter's name. |
| KEYWORD stringrequired in body | body | The campaign keyword. |
| MESSAGE stringoptional in body | body | A welcome text message. |
| NAME stringoptional in body | body | The subscriber's full name. |
| EMAILADDRESS stringoptional in body | body | The subscriber's email address. |
| CUSTOM1 stringoptional in body | body | Custom field 1. CUSTOM2, CUSTOM3 and CUSTOM4 work the same way. |
| DOB stringoptional in body | body | Date of birth, as MM/DD/YYYY. |
| ACTION stringoptional in body | body | ADD subscribes the number; REMOVE unsubscribes it. |
Examples
curl "https://mzone.wire2air.com/mserver/api/SubscribeUser.aspx" \
--data-urlencode "APPKEY=YOUR_APPKEY" \
--data-urlencode "SHORTCODE=27126" \
--data-urlencode "MOBILENUMBER=12121234567" \
--data-urlencode "KEYWORD=coupon" \
--data-urlencode "NAME=Sam Lee" \
--data-urlencode "ACTION=ADD"
import urllib.error
import urllib.parse
import urllib.request
params = urllib.parse.urlencode({
"APPKEY": "YOUR_APPKEY",
"SHORTCODE": "27126",
"MOBILENUMBER": "12121234567",
"KEYWORD": "coupon",
"NAME": "Sam Lee",
"ACTION": "ADD",
})
request = urllib.request.Request(
"https://mzone.wire2air.com/mserver/api/SubscribeUser.aspx",
data=params.encode("utf-8"),
method="POST",
)
try:
with urllib.request.urlopen(request, timeout=30) as response:
print(response.status, response.read().decode("utf-8"))
except urllib.error.HTTPError as error:
print(error.code, error.read().decode("utf-8"))
const params = new URLSearchParams({
APPKEY: "YOUR_APPKEY",
SHORTCODE: "27126",
MOBILENUMBER: "12121234567",
KEYWORD: "coupon",
NAME: "Sam Lee",
ACTION: "ADD",
});
const response = await fetch("https://mzone.wire2air.com/mserver/api/SubscribeUser.aspx", {
method: "POST",
body: params, // sent as application/x-www-form-urlencoded
});
console.log(response.status, await response.text());
<?php
$params = http_build_query([
'APPKEY' => 'YOUR_APPKEY',
'SHORTCODE' => '27126',
'MOBILENUMBER' => '12121234567',
'KEYWORD' => 'coupon',
'NAME' => 'Sam Lee',
'ACTION' => 'ADD',
]);
$ch = curl_init('https://mzone.wire2air.com/mserver/api/SubscribeUser.aspx');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $params,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
]);
$body = curl_exec($ch);
if ($body === false) {
echo 'Request failed: ' . curl_error($ch) . PHP_EOL;
} else {
echo curl_getinfo($ch, CURLINFO_HTTP_CODE) . ' ' . $body . PHP_EOL;
}
curl_close($ch);
using System;
using System.Collections.Generic;
using System.Net.Http;
var parameters = new Dictionary<string, string>
{
["APPKEY"] = "YOUR_APPKEY",
["SHORTCODE"] = "27126",
["MOBILENUMBER"] = "12121234567",
["KEYWORD"] = "coupon",
["NAME"] = "Sam Lee",
["ACTION"] = "ADD",
};
using var client = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Post, "https://mzone.wire2air.com/mserver/api/SubscribeUser.aspx")
{
Content = new FormUrlEncodedContent(parameters),
};
using var response = await client.SendAsync(request);
Console.WriteLine($"{(int)response.StatusCode} {await response.Content.ReadAsStringAsync()}");
Response
ok
| Error | Meaning |
|---|---|
Err:300:Invalid User credentials | The app key is wrong. |
Err:700:Missing Shortcode | SHORTCODE is missing. |
Err:701:Missing VASID | Listed in the previous docs; see the note above. |
Err:702:Missing Keyword/Invalid Keyword | KEYWORD is missing or not a keyword of yours. |
Err:720:Missing Mobile Number | The mobile number is missing. |

