Send an MMS

Send messages to mobile phones with image and long textmessage.

Request

POST https://api.46elks.com/a1/mms

Request parameters

Parameter Example Description
to +46766861004 The phone number of the recipient, in E.164 format.
from +46766861004
noreply
The phone number to send with. Must be an MMS-enabled Virtual Phone Number or the text "noreply", 46elks will replace the sender id with a random phonenumber if "noreply" is used.
message Hi! This is an Message to your phone! An message to be sent with the MMS. Either message or image must be present in the API request.
image http://hello.io/image.jpg
data:image/png;base64,iVBOR...
Either a data URL or a publicly accessible URL that points to an image. GIF, PNG and JPEG images are supported. Either image or message must be present in the API request.

Sample code

curl https://api.46elks.com/a1/MMS \
  -u <Username>:<API Password> \
  -d from=+46766861004 \
  -d to=+46766861004 \
  -d image="https://yourserver.io/images/treasuremap.jpg"
import HTTPotion.base
authdata = [basic_auth: {'',

request = %{
            "from"    => "+46766861004",
            "to"      => "+46766861004",
            "image"   => "https://yourserver.io/images/treasuremap.jpg"
           }

request_data = URI.encode_query(request)

HTTPotion.start
HTTPotion.post("https://api.46elks.com/a1/MMS",
  [body: request_data , ibrowse: authdata]
)
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

public class UnirestSendMMS {
  public static void main(String[] args) {
    try {
      System.out.println("Sending MMS");

      HttpResponse response = Unirest.post("https://api.46elks.com/a1/MMS")
        .basicAuth("","")
        .field("to", "+46766861004")
        .field("from", "+46766861004")
        .field("image", "https://yourserver.io/images/treasuremap.jpg")
        .asString();

      System.out.println(response.getBody());
      }

    catch (Exception e){
        System.out.println(e);
    }
  }
}
function sendMMS ($mms) {
  $username = "USERNAME";
  $password = "PASSWORD";
  $context = stream_context_create(array(
    'http' => array(
      'method' => 'POST',
      'header'  => 'Authorization: Basic '.
                   base64_encode($username.':'.$password). "\r\n".
                   "Content-type: application/x-www-form-urlencoded\r\n",
      'content' => http_build_query($mms),
      'timeout' => 10
  )));
  $response = file_get_contents("https://api.46elks.com/a1/MMS",
    false, $context);

  if (!strstr($http_response_header[0],"200 OK"))
    return $http_response_header[0];
  return $response;
}
$mms = array(
  "from" => "+46766861004",   /* You need an mms enabled phone number */
  "to" => "+46766861004",  /* The mobile number you want to send the image to */
  "image" => "https://yourserver.io/images/treasuremap.jpg",
);
echo sendMMS($mms);
import requests

auth = (
    '',
    ''
    )

fields = {
    'from': '+46766861004',
    'to': '+46766861004',
    'image': 'https://yourserver.io/images/treasuremap.jpg'
    }

response = requests.post(
    "https://api.46elks.com/a1/MMS",
    data=fields,
    auth=auth
    )

print(response.text)
require 'net/http'

uri = URI('https://api.46elks.com/a1/MMS')
req = Net::HTTP::Post.new(uri)
req.basic_auth '', ''
req.set_form_data(
  :from => '+46704508449',
  :to => '+46704508449',
  :image => 'https://yourserver.io/images/treasuremap.jpg'
)

res = Net::HTTP.start(
    uri.host,
    uri.port,
    :use_ssl => uri.scheme == 'https') do |http|
  http.request req
end

puts res.body

More examples
C - C# - Go - Google App Script - Haskell - Node.js - Postman

Response

Example JSON response
{
  "direction": "outgoing",
  "from": "+46766861218",
  "created": "2016-11-03T12:44:56.180704",
  "to": "+46766861004",
  "cost": 12500,
  "message": "Hej!",
  "id": "mf3d05c159aa49e1951c5301bc6af1bac"
}
Attribute Type Description
id string The unique id of the message in our systems.
from string The phonenumber the MMS was sent from.
to string Phoenumber that the MMS was sent to.
message string The text message if the MMS contains a text.
created string The time in UTC when the SMS object was created in our systems.
cost integer The cost of sending the MMS. Specified in 10000s of the currency of the account (SEK or EUR). For example, for an account with currency SEK a cost of 3500 means that it cost 0.35SEK. Learn more about the details of pricing.