cloudwi.re SMS API

Messaging

The five methods in the messaging resource allow you to send messages to opted-in subscribers, reply to responder keywords and send bulk SMS/MMS campaigns. You can also retrieve the delivery status of all of your store messages.

Message Status

Open in API Explorer
GET /message/status/MESSAGETRANSACTIONID

This method allows the developer to retrieve the status of any outbound mobile terminated message sent to the SMS API that involves the Single Messaging Class. That includes the subscriber opt-in methods, Send Message and Send Responder Keyword Message. When using the mentioned methods, cloudwi.re will respond with a tranasactionId. The transactionId will be used in the URL when calling Get Message Status.

It does not include any messages sent via Send Campaign. Status reports for any campaigns can be retrieved in the Campaign Status methods in this resource.

cloudwi.re recommends to developers that a timer set to a minimum of 5 seconds be set and allowed to pass before retrieving message status. Although generally, the carriers report the final status in a few seconds, this process can sometimes take longer during high queuing events.

Example Request

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

url = URI("https://moonbeamapi.cloudwi.re/message/status/MESSAGETRANSACTIONID")

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": "/message/status/MESSAGETRANSACTIONID",
  "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", "/message/status/MESSAGETRANSACTIONID", 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/message/status/MESSAGETRANSACTIONID",
  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/message/status/MESSAGETRANSACTIONID"

	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 Message Blocked

Your message was blocked by cloudwi.re

Messaging Cloudwi.re blocked
{
  "status": "pass",
String
  "code": 200,
Integer
  "message": "Message Status",
String
  results: [
Array
    {
    { ... }
Object

Results

      "transactionId": "58c8d043d16a10ff7259d61e",
String
      "created": "03/15/2017 05:25:23",
String
      "mobileId": "+19994447777",
String
      "message": "Your're right. Michigan football is still a joke. Here's your $10 Buckeye Cash for entering!",
String
      "mediaUrl": "https://cloudwi.re/buckeyes614.jpg",
String
      "errorMessage": {
      "errorMessage": { ... }
Object
        "status": "fail",
String
        "message": "The subscriber is either in Opted-Out, Pending or Locked status or does not exist.",
String
        "messageId": "foo",
String
        "details": "{\"created\":\"03\\/15\\/2017 05:25:24\",\"storeId\":\"5847a690d16a10e867fb4627\",\"mobileID\":\"19994447777\",\"transactionId\":\"58c8d043d16a10ff7259d61e\"}"
String
      },
      "statuses": [
    "foo",
    "foo",
    "foo"
  ]
Array
    }
  ]
}
200 Carrier Receipt

The delivery status of your message.

Messaging Carrier receipt
{
  "status": "pass",
String
  "code": 200,
Integer
  "message": "Message Status",
String
  results: [
Array
    {
    { ... }
Object

Results

      "transactionId": "58ca38c4d16a105b1c59d657",
String
      "created": "03/16/2017 07:03:32",
String
      "mobileId": "+19994447777",
String
      "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
      "mediaUrl": "foo",
String
      "messageId": "SM9decd189061c4ce5b0cc22887623d0d2",
String
      "errorMessage": {
      "errorMessage": { ... }
Object
      },
      statuses: [
Array
        {
        { ... }
Object

Statuses

          "action": "delivered",
String
          "message": "foo",
String
          "errorCode": "foo",
String
          "created": "03/16/2017 07:03:33"
String
        }
      ]
    }
  ]
}
204 Message Queued

Your message is queued and awaiting carrier delivery status.

Messaging Awaiting update
{
  "status": "pass",
String
  "code": 200,
Integer
  "message": "The message is queued and awaiting an update from the upstream carriers.  You may retry your request later.",
String
  "results": [
    "foo",
    "foo",
    "foo"
  ]
Array
}
400 Invalid Transaction ID

Please check the transaction ID and try again.

(Empty Response)

Campaign Delivery Status

Open in API Explorer
GET /campaign/status/TRANSACTIONID/PAGENUMBER

This method allows the developer to page through campaign delivery statistics by campaign transaction ID. It is more reliable than the email report. Only delivery statistics of messages that passed opt-in status checks will be provided in this payload. Any message to a subscriber that was not opted-in will hit your callback URL.

A maximum of 100 records are returned per page.

Example Request

Format:
curl --request GET \
  --url https://moonbeamapi.cloudwi.re/campaign/status/TRANSACTIONID/PAGENUMBER \
  --header 'accept: application/json' \
  --header 'authorization: Bearer SOME.JWT.TOKEN'
require 'uri'
require 'net/http'

url = URI("https://moonbeamapi.cloudwi.re/campaign/status/TRANSACTIONID/PAGENUMBER")

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": "/campaign/status/TRANSACTIONID/PAGENUMBER",
  "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", "/campaign/status/TRANSACTIONID/PAGENUMBER", 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/campaign/status/TRANSACTIONID/PAGENUMBER",
  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/campaign/status/TRANSACTIONID/PAGENUMBER"

	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

Campaign Delivery Status for opted-in subscribers.

(Empty Response)

Campaign Delivery Status by Email

Open in API Explorer
POST /message/campaign/status

This method allows the developer to request a campaign delivery status report via email. The file format selections are JSON or CSV. Currently, cloudwi.re does not notify the developer when a campaign is completed. That is in the pipeline. We recommend that you add 2+ minutes for each 10 thousand messages that you send.

As this file size could be large, please practice patience and ensure your ISP allows large file attachments. We politely deny support inquiries about email reports not being received and only provide this method at an attempt to make the developer's life as easy as possible.

For this reason we provide a much more reliable GET method to retrieve this data by paging through it. If your store has more than 15k messages we advise using the GET to retrieve your subscriber data.

Example Request

Format:
curl --request POST \
  --url https://moonbeamapi.cloudwi.re/message/campaign/status \
  --header 'accept: application/json' \
  --header 'authorization: Bearer SOME.JWT.TOKEN' \
  --header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
  --form storeId=5847ad16a10e867fb4627 \
  --form transactionId=58006caad16a103b2d8d \
  --form fileType=CSV \
  --form email=reports@cloudwi.re
require 'uri'
require 'net/http'

url = URI("https://moonbeamapi.cloudwi.re/message/campaign/status")

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\n5847ad16a10e867fb4627\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"transactionId\"\r\n\r\n58006caad16a103b2d8d\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"fileType\"\r\n\r\nCSV\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"email\"\r\n\r\nreports@cloudwi.re\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": "/message/campaign/status",
  "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\n5847ad16a10e867fb4627\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"transactionId\"\r\n\r\n58006caad16a103b2d8d\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"fileType\"\r\n\r\nCSV\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"email\"\r\n\r\nreports@cloudwi.re\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\n5847ad16a10e867fb4627\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"transactionId\"\r\n\r\n58006caad16a103b2d8d\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"fileType\"\r\n\r\nCSV\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"email\"\r\n\r\nreports@cloudwi.re\r\n-----011000010111000001101001--\r\n"

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

conn.request("POST", "/message/campaign/status", 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/message/campaign/status",
  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\n5847ad16a10e867fb4627\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"transactionId\"\r\n\r\n58006caad16a103b2d8d\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"fileType\"\r\n\r\nCSV\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"email\"\r\n\r\nreports@cloudwi.re\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/message/campaign/status"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"storeId\"\r\n\r\n5847ad16a10e867fb4627\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"transactionId\"\r\n\r\n58006caad16a103b2d8d\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"fileType\"\r\n\r\nCSV\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"email\"\r\n\r\nreports@cloudwi.re\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 that sent the campaign.

5847ad16a10e867fb4627
transactionId String Required

The Transaction ID returned to you when you executed the campaign.

58006caad16a103b2d8d
fileType String Required

The file type you need. Either 'JSON' or 'CSV'

CSV
email String (email) Required

The email address for report delivery.

reports@cloudwi.re

Responses

200 Pass

Your Report has been received by the job queue.

(Empty Response)
400 Invalid Email Address

Really? Yes, really. Send us a valid email address.

(Empty Response)
400 Invalid Transaction ID

The transaction ID is invalid. Please check and try again.

(Empty Response)
400 Invalid File Type

Either 'JSON' or 'CSV' are accepted.

(Empty Response)

Send Campaign to List

Open in API Explorer
POST /message/send/campaign

This method allows the developer to send either an SMS or MMS (or both together) message campaign to a group of selected subscribers within your store. By default, all messages using this method will go out on the communication short code that the subscriber is assigned to by cloudwi.re for the requested store. If the subscriber is not opted-in the message will be blocked.

the mobile list is a collection of numbers that are formatted like this then conveted to sting and passed in the mobileList param

With this method you will pass cloudwi.re a mobileList, which is a collection of numbers, messages and media URLs, that are formatted in JSON and converted to a string. You may send as many messages as you'd like in the call.

Additionally, you can customize the message and media URL for each subscriber you are sending the campaign too. Within the list passed, a 'number' is required. A 'message' or 'mediaUrl' is required as well. You may also pass us both. This gives you the option of sending a dynamic message to each recipient.

The cloudwi.re SMS API will receive the data with a 200 if successful and begin queuing up the campaign and checking the opt-in status of each subscriber you wish to campaign too. The API will then begin sending the campaign at the maximum available throttle. You can use two other methods in this resource to look up delivery data.

Any subscribers who are not in an opted-in state will be reported to the notification URL and dropped from the campaign. Invalid parameters inside of the mobileList parameter string will not echo back and are sent to the notification URL as subscriber not opted-in errors.

Remember that when sending us large campaigns, give the API time to consume your request. A 400k message campaign will take a little bit of time to consume. Alternatively if time outs are a concern, you can consider breaking the campaign into multiple requests.

Considerations

  • Did you scrub for duplicate mobile numbers? It's a really good idea before you hit send because the SMS API does not!
  • The subscriber must be opted-in or the message will be blocked.
  • Store the transaction ID returned to you with a 200 if you want to get a delivery report.
  • Messages are limited to 1600 characters, but we advise 160 because of this. Keep your message short and sweet and you'll be rewarded with better response rates.
  • MMS is limited to 5mb for pictures and 455kb for audio/video. Refer to our MMS supported media for more info on supported URL types for MMS.
  • MMS to carriers who do not support it will be converted to SMS and sent with a URL to the media..
  • Use '\n' to create line breaks inside the message. Read more on that here and make sure you TEST!

Example Request

Format:
curl --request POST \
  --url https://moonbeamapi.cloudwi.re/message/send/campaign \
  --header 'accept: application/json' \
  --header 'authorization: Bearer SOME.JWT.TOKEN' \
  --header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
  --form storeId=5847a690d16a867fb4627 \
  --form 'mobileList=[{"number":"14155964193","message":"Hi There!","mediaUrl":"http://image.4.png"}, {"number":"14155964193","message":"Hi There!","mediaUrl":"http://image.4.png"}]'
require 'uri'
require 'net/http'

url = URI("https://moonbeamapi.cloudwi.re/message/send/campaign")

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\n5847a690d16a867fb4627\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mobileList\"\r\n\r\n[{\"number\":\"14155964193\",\"message\":\"Hi There!\",\"mediaUrl\":\"http://image.4.png\"}, {\"number\":\"14155964193\",\"message\":\"Hi There!\",\"mediaUrl\":\"http://image.4.png\"}]\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": "/message/send/campaign",
  "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\n5847a690d16a867fb4627\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mobileList\"\r\n\r\n[{\"number\":\"14155964193\",\"message\":\"Hi There!\",\"mediaUrl\":\"http://image.4.png\"}, {\"number\":\"14155964193\",\"message\":\"Hi There!\",\"mediaUrl\":\"http://image.4.png\"}]\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\n5847a690d16a867fb4627\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mobileList\"\r\n\r\n[{\"number\":\"14155964193\",\"message\":\"Hi There!\",\"mediaUrl\":\"http://image.4.png\"}, {\"number\":\"14155964193\",\"message\":\"Hi There!\",\"mediaUrl\":\"http://image.4.png\"}]\r\n-----011000010111000001101001--\r\n"

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

conn.request("POST", "/message/send/campaign", 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/message/send/campaign",
  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\n5847a690d16a867fb4627\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mobileList\"\r\n\r\n[{\"number\":\"14155964193\",\"message\":\"Hi There!\",\"mediaUrl\":\"http://image.4.png\"}, {\"number\":\"14155964193\",\"message\":\"Hi There!\",\"mediaUrl\":\"http://image.4.png\"}]\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/message/send/campaign"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"storeId\"\r\n\r\n5847a690d16a867fb4627\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mobileList\"\r\n\r\n[{\"number\":\"14155964193\",\"message\":\"Hi There!\",\"mediaUrl\":\"http://image.4.png\"}, {\"number\":\"14155964193\",\"message\":\"Hi There!\",\"mediaUrl\":\"http://image.4.png\"}]\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 are sending the campaign from.

5847a690d16a867fb4627
mobileList String Required

The list of mobile numbers, messages and media URLs. Either a message or mediaUrl is required. You can also send both. This parameter is a string structured in JSON.

[{"number":"14155964193","message":"Hi There!","mediaUrl":"http://image.4.png"}, {"number":"14155964193","message":"Hi There!","mediaUrl":"http://image.4.png"}]

Responses

200 PASS

Campaign Queued

Messaging Campaign queued
{
  "status": "pass",
String
  "code": 200,
Integer
  "message": "Campaign Queued",
String
  "results": {
  "results": { ... }
Object
    "transactionId": "58c8b153d16a10f91259d61a"
String
  }
}
400 Invalid JSON

Your JSON is malformed. Check it and try again.

(Empty Response)

Send Campaign to All Subscribers

Open in API Explorer
POST /message/campaign/all

This method allows the developer to send either an SMS or MMS (or both together) message campaign to ALL opted-in subscribers within your store. By default, all calls to this method will go out on the communication short code that the subscriber is assigned to by cloudwi.re for the requested store. If the subscriber is not opted-in the message will be blocked and an update on each blocked message will be sent to the notification URL.

Unlike the Send Campaign method to a segmented list, this method requires that the same message and media URL that you pass to the SMS API go out to every subscriber. It cannot be customized for each individual subscriber.

The cloudwi.re SMS API will receive the data with a 200 if successful and begin queuing up all opted-in subscribers in the store to receive the campaign. The API will then begin sending the campaign at the maximum available throttle.

Considerations

  • The subscriber must be opted-in or the message will be blocked.
  • Store the transaction ID returned to you with a 200 if you want to get a delivery report.
  • Messages are limited to 1600 characters, but we advise 160 because of this. Keep your message short and sweet and you'll be rewarded with better response rates.
  • MMS is limited to 5mb for pictures and 455kb for audio/video. Refer to our MMS supported media for more info on supported URL types for MMS.
  • MMS to carriers who do not support it will be sent as a URL.
  • Use '\n' to create line breaks inside the message. Read more on that here and make sure you TEST!

Example Request

Format:
curl --request POST \
  --url https://moonbeamapi.cloudwi.re/message/campaign/all \
  --header 'accept: application/json' \
  --header 'authorization: Bearer SOME.JWT.TOKEN' \
  --header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
  --form storeId=5847a690d16a867fb4627 \
  --form 'message=Everyone is a winner in the OSU v. Michigan blood battle.  Make sure you schedule your donation now!' \
  --form mediaUrl=https://cloudwi.re/buckeyes614.jpg \
  --form sendAll=true
require 'uri'
require 'net/http'

url = URI("https://moonbeamapi.cloudwi.re/message/campaign/all")

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\n5847a690d16a867fb4627\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"message\"\r\n\r\nEveryone is a winner in the OSU v. Michigan blood battle.  Make sure you schedule your donation now!\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mediaUrl\"\r\n\r\nhttps://cloudwi.re/buckeyes614.jpg\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sendAll\"\r\n\r\ntrue\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": "/message/campaign/all",
  "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\n5847a690d16a867fb4627\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"message\"\r\n\r\nEveryone is a winner in the OSU v. Michigan blood battle.  Make sure you schedule your donation now!\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mediaUrl\"\r\n\r\nhttps://cloudwi.re/buckeyes614.jpg\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sendAll\"\r\n\r\ntrue\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\n5847a690d16a867fb4627\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"message\"\r\n\r\nEveryone is a winner in the OSU v. Michigan blood battle.  Make sure you schedule your donation now!\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mediaUrl\"\r\n\r\nhttps://cloudwi.re/buckeyes614.jpg\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sendAll\"\r\n\r\ntrue\r\n-----011000010111000001101001--\r\n"

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

conn.request("POST", "/message/campaign/all", 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/message/campaign/all",
  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\n5847a690d16a867fb4627\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"message\"\r\n\r\nEveryone is a winner in the OSU v. Michigan blood battle.  Make sure you schedule your donation now!\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mediaUrl\"\r\n\r\nhttps://cloudwi.re/buckeyes614.jpg\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sendAll\"\r\n\r\ntrue\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/message/campaign/all"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"storeId\"\r\n\r\n5847a690d16a867fb4627\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"message\"\r\n\r\nEveryone is a winner in the OSU v. Michigan blood battle.  Make sure you schedule your donation now!\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mediaUrl\"\r\n\r\nhttps://cloudwi.re/buckeyes614.jpg\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sendAll\"\r\n\r\ntrue\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 you are sending the campaign from.

5847a690d16a867fb4627
message String Required

Self explanatory unless you are a Michigan fan. *Optional if sending media

Everyone is a winner in the OSU v. Michigan blood battle. Make sure you schedule your donation now!
mediaUrl String (url) Required

The URL of any media you wish to send. *Optional if message is included

https://cloudwi.re/buckeyes614.jpg
sendAll String Required

Must be set to 'true'

true

Responses

200 PASS

Campaign Queued

Messaging Campaign queued
{
  "status": "pass",
String
  "code": 200,
Integer
  "message": "Campaign Queued",
String
  "results": {
  "results": { ... }
Object
    "transactionId": "58c8b153d16a10f91259d61a"
String
  }
}
400 Invalid Send All Parameter

Please select 'true'.

(Empty Response)
400 Invalid Media URL

Media URLs must begin with HTTP:// or HTTPS://

(Empty Response)
400 Character Count Exceeded

Messages are capped at 1600 characters.

(Empty Response)
400 Message or Media URL Required

A message or media URL is required

(Empty Response)

Send Message

Open in API Explorer
POST /message/send/message

This method allows the developer to send a text or picture message (Or Both!) to an opted-in subscriber from the store you assign within your auth string. By default, all calls to this method will go out on the communication short code that the customer is assigned to by cloudwi.re for the requested store. This method is not to be utilized for sending bulk campaigns.

Any message attempted to a subscriber who is not in an opted-in state will be reported as an error in the Get Status method and delivered to the store call back URL.

Considerations

  • If the subscriber is not opted-in cloudwi.re won't attempt a message.
  • Messages are limited to 1600 characters, but we advise 160 because of this. Keep your messages short and sweet and you'll have a more successful response rate.
  • MMS is limited to 5mb for pictures and 455kb for audio/video. Refer to our MMS supported media for more info on supported URL types for MMS.
  • Media URLs must begin with HTTP:// or HTTPS://
  • MMS to carriers who do not support it will be sent as a URL.
  • We have unpublished features for one and two way mobile alerts. Contact support@cloudwi.re.

Example Request

Format:
curl --request POST \
  --url https://moonbeamapi.cloudwi.re/message/send/message \
  --header 'accept: application/json' \
  --header 'authorization: Bearer SOME.JWT.TOKEN' \
  --header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
  --form storeId=5847a690d16a867fb4627 \
  --form mobileId=19994447777 \
  --form 'message=Everyone is a winner in the OSU v. Michigan blood battle.  Make sure you schedule your donation now!' \
  --form mediaUrl=https://cloudwi.re/buckeyes614.jpg
require 'uri'
require 'net/http'

url = URI("https://moonbeamapi.cloudwi.re/message/send/message")

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\n5847a690d16a867fb4627\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mobileId\"\r\n\r\n19994447777\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"message\"\r\n\r\nEveryone is a winner in the OSU v. Michigan blood battle.  Make sure you schedule your donation now!\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mediaUrl\"\r\n\r\nhttps://cloudwi.re/buckeyes614.jpg\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": "/message/send/message",
  "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\n5847a690d16a867fb4627\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mobileId\"\r\n\r\n19994447777\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"message\"\r\n\r\nEveryone is a winner in the OSU v. Michigan blood battle.  Make sure you schedule your donation now!\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mediaUrl\"\r\n\r\nhttps://cloudwi.re/buckeyes614.jpg\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\n5847a690d16a867fb4627\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mobileId\"\r\n\r\n19994447777\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"message\"\r\n\r\nEveryone is a winner in the OSU v. Michigan blood battle.  Make sure you schedule your donation now!\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mediaUrl\"\r\n\r\nhttps://cloudwi.re/buckeyes614.jpg\r\n-----011000010111000001101001--\r\n"

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

conn.request("POST", "/message/send/message", 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/message/send/message",
  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\n5847a690d16a867fb4627\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mobileId\"\r\n\r\n19994447777\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"message\"\r\n\r\nEveryone is a winner in the OSU v. Michigan blood battle.  Make sure you schedule your donation now!\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mediaUrl\"\r\n\r\nhttps://cloudwi.re/buckeyes614.jpg\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/message/send/message"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"storeId\"\r\n\r\n5847a690d16a867fb4627\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mobileId\"\r\n\r\n19994447777\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"message\"\r\n\r\nEveryone is a winner in the OSU v. Michigan blood battle.  Make sure you schedule your donation now!\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mediaUrl\"\r\n\r\nhttps://cloudwi.re/buckeyes614.jpg\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 you are sending the message from.

5847a690d16a867fb4627
mobileId String Required

The mobile ID of the subscriber you are messaging.

19994447777
message String Optional

Self explanatory unless you are a Michigan fan. *Optional if sending media

Everyone is a winner in the OSU v. Michigan blood battle. Make sure you schedule your donation now!
mediaUrl String (url) Optional

The URL of any media you wish to send. *Optional if message is included

https://cloudwi.re/buckeyes614.jpg

Responses

200 Pass

Message Queued

Messaging Message queued
{
  "status": "pass",
String
  "code": 200,
Integer
  "message": "Message Queued",
String
  "results": {
  "results": { ... }
Object
    "transactionId": "58c8b171d16a10361359d617"
String
  }
}
400 Message or Media URL Required

A message or media URL is required

(Empty Response)
400 Character Count Exceeded

Messages are capped at 1600 characters.

(Empty Response)
400 Invalid Media URL

Media URLs must begin with HTTP:// or HTTPS://

(Empty Response)

Send Campaign to CSV

Open in API Explorer
POST /message/import/campaign

This method allows the developer to send either an SMS or MMS via a CSV of mobile numbers. It exists for developers building user interfaces for their end users. By default, all calls to this method will go out on the communication short code that the subscriber is assigned to by cloudwi.re for the requested store. If the subscriber is not opted-in the message will be blocked and an update on each blocked message will be sent to the notification URL.

Unlike the Send Campaign method to a segmented list, this method requires that the same message and media URL that you pass to the SMS API go out to every subscriber. It cannot be customized for each individual subscriber.

The CSV is simply a list of mobile numbers that should receive the campaign. Please be advised that cloudwi.re accepts windows formatted CSVs only. Each number should be in its own row and all numbers should reside in the first column of the CSV. Make sure you format the numbers correctly.

The cloudwi.re SMS API will receive the data with a 200 if successful and begin queuing up all opted-in subscribers in the store to receive the campaign. The API will then begin sending the campaign at the maximum available throttle.

Considerations

  • The subscriber must be opted-in or the message will be blocked.
  • Store the transaction ID returned to you with a 200 if you want to get a delivery report.
  • Messages are limited to 1600 characters, but we advise 160 because of this. Keep your message short and sweet and you'll be rewarded with better response rates.
  • MMS is limited to 5mb for pictures and 455kb for audio/video. Refer to our MMS supported media for more info on supported URL types for MMS.
  • MMS to carriers who do not support it will be sent as a URL.
  • Use '\n' to create line breaks inside the message. Read more on that here and make sure you TEST!

Example Request

Format:
curl --request POST \
  --url https://moonbeamapi.cloudwi.re/message/import/campaign \
  --header 'accept: application/json' \
  --header 'authorization: Bearer SOME.JWT.TOKEN' \
  --header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
  --form storeId=5847a690d16a867fb4627 \
  --form 'message=Everyone is a winner in the OSU v. Michigan blood battle.  Make sure you schedule your donation now!' \
  --form mediaUrl=https://cloudwi.re/buckeyes614.jpg \
  --form name=Buckeyes1 \
  --form file=buckeyes3.csv
require 'uri'
require 'net/http'

url = URI("https://moonbeamapi.cloudwi.re/message/import/campaign")

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\n5847a690d16a867fb4627\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"message\"\r\n\r\nEveryone is a winner in the OSU v. Michigan blood battle.  Make sure you schedule your donation now!\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mediaUrl\"\r\n\r\nhttps://cloudwi.re/buckeyes614.jpg\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nBuckeyes1\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\nbuckeyes3.csv\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": "/message/import/campaign",
  "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\n5847a690d16a867fb4627\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"message\"\r\n\r\nEveryone is a winner in the OSU v. Michigan blood battle.  Make sure you schedule your donation now!\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mediaUrl\"\r\n\r\nhttps://cloudwi.re/buckeyes614.jpg\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nBuckeyes1\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\nbuckeyes3.csv\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\n5847a690d16a867fb4627\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"message\"\r\n\r\nEveryone is a winner in the OSU v. Michigan blood battle.  Make sure you schedule your donation now!\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mediaUrl\"\r\n\r\nhttps://cloudwi.re/buckeyes614.jpg\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nBuckeyes1\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\nbuckeyes3.csv\r\n-----011000010111000001101001--\r\n"

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

conn.request("POST", "/message/import/campaign", 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/message/import/campaign",
  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\n5847a690d16a867fb4627\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"message\"\r\n\r\nEveryone is a winner in the OSU v. Michigan blood battle.  Make sure you schedule your donation now!\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mediaUrl\"\r\n\r\nhttps://cloudwi.re/buckeyes614.jpg\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nBuckeyes1\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\nbuckeyes3.csv\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/message/import/campaign"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"storeId\"\r\n\r\n5847a690d16a867fb4627\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"message\"\r\n\r\nEveryone is a winner in the OSU v. Michigan blood battle.  Make sure you schedule your donation now!\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mediaUrl\"\r\n\r\nhttps://cloudwi.re/buckeyes614.jpg\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nBuckeyes1\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\nbuckeyes3.csv\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

5847a690d16a867fb4627

5847a690d16a867fb4627
message String Required

Self explanatory unless you are a Michigan fan. *Optional if sending media

Everyone is a winner in the OSU v. Michigan blood battle. Make sure you schedule your donation now!
mediaUrl String Required

The URL of any media you wish to send. *Optional if message is included

https://cloudwi.re/buckeyes614.jpg
name String Required

A campaign name

Buckeyes1
file File Required

A windows formatted CSV of mobile numbers with one number on each row.

buckeyes3.csv

Responses

200 Pass

Campaign Queued

Messaging Campaign queued
{
  "status": "pass",
String
  "code": 200,
Integer
  "message": "Campaign Queued",
String
  "results": {
  "results": { ... }
Object
    "transactionId": "58c8b153d16a10f91259d61a"
String
  }
}
400 Invalid Name

Please limit your campaign name to 40 characters or less.

(Empty Response)
400 Invalid File

Please check your file formatting. Only Windows Formatted CSVs are accepted.

(Empty Response)
400 Message or Media URL Required

A message or media URL is required

(Empty Response)
400 Character Count Exceeded

Messages are capped at 1600 characters.

(Empty Response)
400 Invalid Media URL

Media URLs must begin with HTTP:// or HTTPS://

(Empty Response)

Send Responder Keyword Message

Open in API Explorer
POST /message/send/responderkeywordmessage

This method allows the developer to send a response to a subscriber that has sent a responder keyword to a cloudwi.re marketing short code. Keep in mind that cloudwi.re can automate this task for you using the Edit Responder Keyword Content in the Keyword Creation & Management resource.

But for those developers who wish to reply to responder keywords dynamically, this method will come in handy. cloudwi.re will validate your parameters for spam prevention. But if your parameters show the keyword and short code you request as belonging to your store, cloudwi.re will send the message and it will go out regardless of the opt-in status of the subscriber.

The subscriber is requesting only one response. Any additional follow-up messages utilizing this method to a subscriber is not compliant and is a violation of the cloudwi.re terms & conditions.

Considerations

  • Messages are limited to 1600 characters, but we advise 160 because of this.
  • MMS is limited to 5mb for pictures and 455kb for audio/video. Refer to our MMS supported media for more info on supported URL types for MMS.
  • Media URLs must begin with http:// or https://
  • MMS to carriers who do not support it will be sent as a URL.

Example Request

Format:
curl --request POST \
  --url https://moonbeamapi.cloudwi.re/message/send/responderkeywordmessage \
  --header 'accept: application/json' \
  --header 'authorization: Bearer SOME.JWT.TOKEN' \
  --header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
  --form storeId=5847a690d16a10e867f \
  --form mobileId=19994447777 \
  --form keywordId=5881b92fd16a1068d7881 \
  --form 'message=Your'\''re right.  Michigan football is still a joke.  Here'\''s your $10 Buckeye Cash for entering!' \
  --form mediaUrl=https://cloudwi.re/buckeyes614.jpg
require 'uri'
require 'net/http'

url = URI("https://moonbeamapi.cloudwi.re/message/send/responderkeywordmessage")

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\n5847a690d16a10e867f\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mobileId\"\r\n\r\n19994447777\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"keywordId\"\r\n\r\n5881b92fd16a1068d7881\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"message\"\r\n\r\nYour're right.  Michigan football is still a joke.  Here's your $10 Buckeye Cash for entering!\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mediaUrl\"\r\n\r\nhttps://cloudwi.re/buckeyes614.jpg\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": "/message/send/responderkeywordmessage",
  "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\n5847a690d16a10e867f\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mobileId\"\r\n\r\n19994447777\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"keywordId\"\r\n\r\n5881b92fd16a1068d7881\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"message\"\r\n\r\nYour're right.  Michigan football is still a joke.  Here's your $10 Buckeye Cash for entering!\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mediaUrl\"\r\n\r\nhttps://cloudwi.re/buckeyes614.jpg\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\n5847a690d16a10e867f\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mobileId\"\r\n\r\n19994447777\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"keywordId\"\r\n\r\n5881b92fd16a1068d7881\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"message\"\r\n\r\nYour're right.  Michigan football is still a joke.  Here's your $10 Buckeye Cash for entering!\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mediaUrl\"\r\n\r\nhttps://cloudwi.re/buckeyes614.jpg\r\n-----011000010111000001101001--\r\n"

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

conn.request("POST", "/message/send/responderkeywordmessage", 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/message/send/responderkeywordmessage",
  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\n5847a690d16a10e867f\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mobileId\"\r\n\r\n19994447777\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"keywordId\"\r\n\r\n5881b92fd16a1068d7881\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"message\"\r\n\r\nYour're right.  Michigan football is still a joke.  Here's your $10 Buckeye Cash for entering!\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mediaUrl\"\r\n\r\nhttps://cloudwi.re/buckeyes614.jpg\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/message/send/responderkeywordmessage"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"storeId\"\r\n\r\n5847a690d16a10e867f\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mobileId\"\r\n\r\n19994447777\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"keywordId\"\r\n\r\n5881b92fd16a1068d7881\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"message\"\r\n\r\nYour're right.  Michigan football is still a joke.  Here's your $10 Buckeye Cash for entering!\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mediaUrl\"\r\n\r\nhttps://cloudwi.re/buckeyes614.jpg\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 that the keyword is assigned.

5847a690d16a10e867f
mobileId String Required

The mobile number receiving the message.

19994447777
keywordId String Required

The Keyword ID of the keyword the subscriber texted in.

5881b92fd16a1068d7881
message String Optional

Your return message. *Optional if MMS URL Selected

Your're right. Michigan football is still a joke. Here's your $10 Buckeye Cash for entering!
mediaUrl String (url) Optional

The URL of any media you want to send to the subscriber.
Optional if message is included.

https://cloudwi.re/buckeyes614.jpg

Responses

200 Pass

Message Queued

Messaging Responder keyword pass
{
  "status": "pass",
String
  "code": 200,
Integer
  "message": "Send Responder Message",
String
  "results": {
  "results": { ... }
Object
    "transactionId": "58c8d0b8d16a10f61259d616"
String
  }
}
400 Invalid Mobile ID

The mobile ID is not a valid phone number.

(Empty Response)
400 Invalid Keyword ID

The keyword ID you sent is invalid.

(Empty Response)
400 Character Count Exceeded

Messages are capped at 1600 characters.

(Empty Response)
400 Invalid Media URL

Media URLs must begin with HTTP:// or HTTPS://

(Empty Response)
400 Message or Media URL Required

A message or media URL is required.

(Empty Response)