cloudwi.re SMS API

Subscriber Creation & Management

The four methods that comprise the Subscriber resource exist to opt-in and opt-out subscribers to a store. Subscriber's must be opted-in to a store for recurring messaging. Additionally, the developer can also look up individual subscriber opt-in status at the store level and retrieve individual subscriber message history with a store.

Subscriber Store Status

Open in API Explorer
GET /subscriber/statusbystore/STOREIDHERE/MOBILEIDHERE

This method allows the developer to check the opt-in status of a subscriber at the store level. The store ID and the mobile number will be passed in the request URL as noted in the URL above.

Example Request

Format:
curl --request GET \
  --url https://moonbeamapi.cloudwi.re/subscriber/statusbystore/STOREIDHERE/MOBILEIDHERE \
  --header 'accept: application/json' \
  --header 'authorization: Bearer SOME.JWT.TOKEN'
require 'uri'
require 'net/http'

url = URI("https://moonbeamapi.cloudwi.re/subscriber/statusbystore/STOREIDHERE/MOBILEIDHERE")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
request["authorization"] = 'Bearer SOME.JWT.TOKEN'

response = http.request(request)
puts response.read_body
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "moonbeamapi.cloudwi.re",
  "port": null,
  "path": "/subscriber/statusbystore/STOREIDHERE/MOBILEIDHERE",
  "headers": {
    "accept": "application/json",
    "authorization": "Bearer SOME.JWT.TOKEN"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
import http.client

conn = http.client.HTTPSConnection("moonbeamapi.cloudwi.re")

headers = {
    'accept': "application/json",
    'authorization': "Bearer SOME.JWT.TOKEN"
    }

conn.request("GET", "/subscriber/statusbystore/STOREIDHERE/MOBILEIDHERE", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://moonbeamapi.cloudwi.re/subscriber/statusbystore/STOREIDHERE/MOBILEIDHERE",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "authorization: Bearer SOME.JWT.TOKEN"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://moonbeamapi.cloudwi.re/subscriber/statusbystore/STOREIDHERE/MOBILEIDHERE"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "application/json")
	req.Header.Add("authorization", "Bearer SOME.JWT.TOKEN")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}

Responses

200 pass

The Subscriber's store opt-in status.

Subscriber Creation & Management Subscriber status
{
  "status": "pass",
String
  "code": 200,
Integer
  "message": "Subscriber By Store ",
String
  "results": {
  "results": { ... }
Object
    "id": "57e35fe0d16a10360f8b4567",
String
    "created": "09/22/2016 04:36:48",
String
    "mobileId": "19994447777",
String
    "details": {
    "details": { ... }
Object
      "commChannel": "+24411",
String
      "subscriberStatus": "Opted-In",
String
      "created": "09/22/2016 04:36:48",
String
      "keywordType": "Opt-In",
String
      "shortCode": "+444999",
String
      "keywordId": "5e2a656a104975fccfbd",
String
      "storeId": "5e2a65ed16a104975fccfbd",
String
      "storeName": "cloudwi.re",
String
      "accountId": "52a61d16a104a75fccfc0",
String
      "keyword": "cloudwire",
String
      "optInAttempts": 0
Integer
    }
  }
}
400 Subscriber does not exist

The subscriber does not exist in the store. Check the mobile ID and try again.

(Empty Response)

Send Opt-out

Open in API Explorer
POST /subscriber/sendoptout

This method allows the developer to opt-out a subscriber from a store and trigger the delivery of the store opt-out confirmation. After completion, the subscriber can receive no further text messages from the store and the subscriber status will change to opted-out. After the opt-out is completed, the SMS API will release the mobile subscriber from the assigned communication short code.

The API will respond synchronously if the subscriber is already opted-out and no message will be attempted.

Example Request

Format:
curl --request POST \
  --url https://moonbeamapi.cloudwi.re/subscriber/sendoptout \
  --header 'accept: application/json' \
  --header 'authorization: Bearer SOME.JWT.TOKEN' \
  --header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
  --form mobileId=19995552525 \
  --form storeId=SIDkdw223lken23ln3o9nw0nken
require 'uri'
require 'net/http'

url = URI("https://moonbeamapi.cloudwi.re/subscriber/sendoptout")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["accept"] = 'application/json'
request["authorization"] = 'Bearer SOME.JWT.TOKEN'
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mobileId\"\r\n\r\n19995552525\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"storeId\"\r\n\r\nSIDkdw223lken23ln3o9nw0nken\r\n-----011000010111000001101001--\r\n"

response = http.request(request)
puts response.read_body
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "moonbeamapi.cloudwi.re",
  "port": null,
  "path": "/subscriber/sendoptout",
  "headers": {
    "accept": "application/json",
    "authorization": "Bearer SOME.JWT.TOKEN",
    "content-type": "multipart/form-data; boundary=---011000010111000001101001"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mobileId\"\r\n\r\n19995552525\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"storeId\"\r\n\r\nSIDkdw223lken23ln3o9nw0nken\r\n-----011000010111000001101001--\r\n");
req.end();
import http.client

conn = http.client.HTTPSConnection("moonbeamapi.cloudwi.re")

payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mobileId\"\r\n\r\n19995552525\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"storeId\"\r\n\r\nSIDkdw223lken23ln3o9nw0nken\r\n-----011000010111000001101001--\r\n"

headers = {
    'accept': "application/json",
    'authorization': "Bearer SOME.JWT.TOKEN",
    'content-type': "multipart/form-data; boundary=---011000010111000001101001"
    }

conn.request("POST", "/subscriber/sendoptout", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://moonbeamapi.cloudwi.re/subscriber/sendoptout",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mobileId\"\r\n\r\n19995552525\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"storeId\"\r\n\r\nSIDkdw223lken23ln3o9nw0nken\r\n-----011000010111000001101001--\r\n",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "authorization: Bearer SOME.JWT.TOKEN",
    "content-type: multipart/form-data; boundary=---011000010111000001101001"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://moonbeamapi.cloudwi.re/subscriber/sendoptout"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mobileId\"\r\n\r\n19995552525\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"storeId\"\r\n\r\nSIDkdw223lken23ln3o9nw0nken\r\n-----011000010111000001101001--\r\n")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("accept", "application/json")
	req.Header.Add("authorization", "Bearer SOME.JWT.TOKEN")
	req.Header.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}

Form Data Parameters

Name Type Required Description Example
mobileId String Required

10 digit mobile number. (Example: 19995551234, +19995551234)

19995552525
storeId String Required

The StoreID for which you wish to opt-in a subscriber to.

SIDkdw223lken23ln3o9nw0nken

Responses

200 Pass

Subscriber is now opted-out and opt-in confirmation is sent.

Subscriber Creation & Management Opt-out successful
{
  "status": "pass",
String
  "code": 200,
Integer
  "message": "Subscriber Updated",
String
  "results": {
  "results": { ... }
Object
    "id": "58c7ad16a10a61f8b4567",
String
    "created": "03/16/2017 17:16:42",
String
    "mobileId": "19994447777",
String
    "transactionId": "58cad671d160f71259d662",
String
    "details": {
    "details": { ... }
Object
      "commChannel": "+36546",
String
      "subscriberStatus": "Opted-Out",
String
      "mCreate": {
      "mCreate": { ... }
Object
        "sec": 1489684602,
Integer
        "usec": 0
Integer
      },
      "created": "03/16/2017 17:16:42",
String
      "keywordType": "foo",
String
      "shortCode": "foo",
String
      "keywordId": "foo",
String
      "storeId": "5847a690a10e867fb4627",
String
      "storeName": "Craig Four",
String
      "accountId": "5847a366a10e867fb4625",
String
      "keyword": "foo",
String
      "optInAttempts": 1
Integer
    }
  }
}
400 Subscriber is already opted-out

The subscriber is already opted-out and no opt-out message is required.

(Empty Response)

Send Opt-In

Open in API Explorer
POST /subscriber/sendoptin

This method allows the developer to create a subscriber for the store you assign within your auth string. The SMS API will then deliver a compliant opt-in confirmation or request message (Depending on whether you use the single or double parameter) to the subscriber. It is required before you can send any recurring text messages to a mobile subscriber using Send Message or Send Campaign, except where otherwise noted.

It is developer discretion on using single opt-in. Read the compliance guide here on best practices.

The subscriber will now be assigned a communication short code and all 2-way SMS communication with the subscriber will occur on that assigned communication short code for the life of the opt-in.

The API will consume your request for any valid phone number and return a 200 synchronously. If the number is invalid, the API will fail that synchronously as well. Other failures, such as attempting to use single opt-in on a pending subscriber, will be sent asynchronously to your notification URL and available from the transaction ID via Get Message Status.

Remember to pass numbers with no spaces or + sign and include the country code. (Exp: '19994447777')

Considerations

  • Opt-in templates fired to the subscriber in this method are pulled from the store templates. They cannot be dynamically controlled for compliance reasons.
  • For double opt-in, the subscriber must reply YES or Y to the opt-in request to complete the opt-in. Once cloudwi.re receives the YES or Y it will automate delivery of the opt-in confirmation and switch the subscriber's status to opted-in.
  • If the subscriber is in an opted-out or pending state and single opt-in is attempted, it will error out. In this event Double opt-in is required.
  • If the subscriber is in an locked state and single or double opt-in is attempted it will be blocked.
  • If the subscriber replies NO or N to a double opt-in request they will be switched to an opted-out state.

Example Request

Format:
curl --request POST \
  --url https://moonbeamapi.cloudwi.re/subscriber/sendoptin \
  --header 'accept: application/json' \
  --header 'authorization: Bearer SOME.JWT.TOKEN' \
  --header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
  --form mobileId=19995552525 \
  --form optInType=double \
  --form storeId=SIDkdw223lken23ln3o9nw0nken
require 'uri'
require 'net/http'

url = URI("https://moonbeamapi.cloudwi.re/subscriber/sendoptin")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["accept"] = 'application/json'
request["authorization"] = 'Bearer SOME.JWT.TOKEN'
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mobileId\"\r\n\r\n19995552525\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"optInType\"\r\n\r\ndouble\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"storeId\"\r\n\r\nSIDkdw223lken23ln3o9nw0nken\r\n-----011000010111000001101001--\r\n"

response = http.request(request)
puts response.read_body
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "moonbeamapi.cloudwi.re",
  "port": null,
  "path": "/subscriber/sendoptin",
  "headers": {
    "accept": "application/json",
    "authorization": "Bearer SOME.JWT.TOKEN",
    "content-type": "multipart/form-data; boundary=---011000010111000001101001"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mobileId\"\r\n\r\n19995552525\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"optInType\"\r\n\r\ndouble\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"storeId\"\r\n\r\nSIDkdw223lken23ln3o9nw0nken\r\n-----011000010111000001101001--\r\n");
req.end();
import http.client

conn = http.client.HTTPSConnection("moonbeamapi.cloudwi.re")

payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mobileId\"\r\n\r\n19995552525\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"optInType\"\r\n\r\ndouble\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"storeId\"\r\n\r\nSIDkdw223lken23ln3o9nw0nken\r\n-----011000010111000001101001--\r\n"

headers = {
    'accept': "application/json",
    'authorization': "Bearer SOME.JWT.TOKEN",
    'content-type': "multipart/form-data; boundary=---011000010111000001101001"
    }

conn.request("POST", "/subscriber/sendoptin", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://moonbeamapi.cloudwi.re/subscriber/sendoptin",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mobileId\"\r\n\r\n19995552525\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"optInType\"\r\n\r\ndouble\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"storeId\"\r\n\r\nSIDkdw223lken23ln3o9nw0nken\r\n-----011000010111000001101001--\r\n",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "authorization: Bearer SOME.JWT.TOKEN",
    "content-type: multipart/form-data; boundary=---011000010111000001101001"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://moonbeamapi.cloudwi.re/subscriber/sendoptin"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mobileId\"\r\n\r\n19995552525\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"optInType\"\r\n\r\ndouble\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"storeId\"\r\n\r\nSIDkdw223lken23ln3o9nw0nken\r\n-----011000010111000001101001--\r\n")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("accept", "application/json")
	req.Header.Add("authorization", "Bearer SOME.JWT.TOKEN")
	req.Header.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}

Form Data Parameters

Name Type Required Description Example
mobileId String Required

10 digit mobile number. (Example: 19995551234, +19995551234)

19995552525
optInType String Required

'single' for one-step and 'double' for two step optin

double
storeId String Required

The StoreID for which you wish to opt-in the subscriber to.

SIDkdw223lken23ln3o9nw0nken

Responses

200 pass

The message is queued for delivery and the Subscriber's status is updated to opted-in.

Subscriber Creation & Management Opt-in sent
{
  "status": "pass",
String
  "code": 200,
Integer
  "message": "Message Id",
String
  "results": {
  "results": { ... }
Object
    "messageId": "SMbefa299c25174352b4541dd9a51ab7af"
String
  }
}
400 Invalid Mobile ID

The number you are passing is invalid. Please try again. Remember, no spaces and no + sign. Include the country code (EXP: '19994447777')

(Empty Response)

Subscriber Store Message History

Open in API Explorer
POST /subscriber/message/history

This method allows the developer to retrieve and page through individual subscriber message history at the store level by set dates. A maximum of 100 records are returned for each request. It will include failed messages which were blocked by cloudwi.re. Delivery status of the message is also included along with the message and message ID.

The most recent records are served first. If you want the latest data, select page 1 and work to the past from there.

Remember to pass your mobile number without a + sign and no spaces (Exp: '19994447777'). cloudwi.re does not validate mobile numbers in this method.

Example Request

Format:
curl --request POST \
  --url 'https://moonbeamapi.cloudwi.re/subscriber/message/history?end=2017-03-16' \
  --header 'accept: application/json' \
  --header 'authorization: Bearer SOME.JWT.TOKEN' \
  --header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
  --form storeId=847a690d16a10e867fb4 \
  --form mobileId=19994447777 \
  --form start=2017-03-15 \
  --form page=1
require 'uri'
require 'net/http'

url = URI("https://moonbeamapi.cloudwi.re/subscriber/message/history?end=2017-03-16")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["accept"] = 'application/json'
request["authorization"] = 'Bearer SOME.JWT.TOKEN'
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"storeId\"\r\n\r\n847a690d16a10e867fb4\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mobileId\"\r\n\r\n19994447777\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"start\"\r\n\r\n2017-03-15\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"page\"\r\n\r\n1\r\n-----011000010111000001101001--\r\n"

response = http.request(request)
puts response.read_body
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "moonbeamapi.cloudwi.re",
  "port": null,
  "path": "/subscriber/message/history?end=2017-03-16",
  "headers": {
    "accept": "application/json",
    "authorization": "Bearer SOME.JWT.TOKEN",
    "content-type": "multipart/form-data; boundary=---011000010111000001101001"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"storeId\"\r\n\r\n847a690d16a10e867fb4\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mobileId\"\r\n\r\n19994447777\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"start\"\r\n\r\n2017-03-15\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"page\"\r\n\r\n1\r\n-----011000010111000001101001--\r\n");
req.end();
import http.client

conn = http.client.HTTPSConnection("moonbeamapi.cloudwi.re")

payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"storeId\"\r\n\r\n847a690d16a10e867fb4\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mobileId\"\r\n\r\n19994447777\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"start\"\r\n\r\n2017-03-15\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"page\"\r\n\r\n1\r\n-----011000010111000001101001--\r\n"

headers = {
    'accept': "application/json",
    'authorization': "Bearer SOME.JWT.TOKEN",
    'content-type': "multipart/form-data; boundary=---011000010111000001101001"
    }

conn.request("POST", "/subscriber/message/history?end=2017-03-16", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://moonbeamapi.cloudwi.re/subscriber/message/history?end=2017-03-16",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"storeId\"\r\n\r\n847a690d16a10e867fb4\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mobileId\"\r\n\r\n19994447777\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"start\"\r\n\r\n2017-03-15\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"page\"\r\n\r\n1\r\n-----011000010111000001101001--\r\n",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "authorization: Bearer SOME.JWT.TOKEN",
    "content-type: multipart/form-data; boundary=---011000010111000001101001"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://moonbeamapi.cloudwi.re/subscriber/message/history?end=2017-03-16"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"storeId\"\r\n\r\n847a690d16a10e867fb4\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mobileId\"\r\n\r\n19994447777\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"start\"\r\n\r\n2017-03-15\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"page\"\r\n\r\n1\r\n-----011000010111000001101001--\r\n")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("accept", "application/json")
	req.Header.Add("authorization", "Bearer SOME.JWT.TOKEN")
	req.Header.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}

Form Data Parameters

Name Type Required Description Example
storeId String Required

The store ID of the store you wish to retrieve history from.

847a690d16a10e867fb4
mobileId String Required

The mobile number you wish to pull history for.

19994447777
start String Required

The start date of the search in 'YYYY-MM-DD' format.

2017-03-15
page String Required

The page number of the results.

1

Query Parameters

Name Type Required Description Example
end String Required

The end date of the search in 'YYYY-MM-DD' format.

2017-03-16

Responses

200 PASS

The subscriber's message history with the store.

Subscriber Creation & Management Subscriber message history
{
  "status": "pass",
String
  "code": 200,
Integer
  "message": "Subscriber History",
String
  "results": {
  "results": { ... }
Object
    history: [
Array
      {
      { ... }
Object

History

        "created": "03/15/2017 19:40:53",
String
        "campaign": false,
Boolean
        "message": "You have opted-in to cloudwi.re Alerts & Offers. Msg&Data rates may apply. Max 5msgs/mth. Reply HELP for help, STOP to quit.",
String
        "storeId": "5847a690d16a10e867fb4627",
String
        "status": {
        "status": { ... }
Object
          "messageId": "SM53d550dcd4498493a1891aa0fe73e7",
String
          "status": "delivered",
String
          "mCreate": {
          "mCreate": { ... }
Object
            "sec": 1489606853,
Integer
            "usec": 540000
Integer
          }
        }
      }
    ]
    "count": 2,
Integer
    "maxPerPage": 100,
Integer
    "pages": 1
Integer
  }
}
400 Invalid Date Format

Please pass your date in 'YYYY-MM-DD'

(Empty Response)