Skip to content
Wire2AirWire2Air

Inbound SMS and MMS

Wire2Air forwards picture messages (and text) sent to your short code to your server as a GET request with the subject, the media location and the file names.

Last updated

This webhook delivers MMS (picture messages) as well as SMS. Wire2Air receives the message from the carrier, matches it to your account by short code and keyword, and calls your URL.

GEThttps://your-server.example/wire2air/inbound-mms
Credential
None. Wire2Air calls a URL on your server

Your URL. Wire2Air appends the parameters below as a query string.

Parameters

Parameters
ParameterDescription
mobilenumber
stringrequired
in query
The sender's mobile number.
message
stringoptional
in query
Text the sender wrote.
rcvd
stringrequired
in query
When Wire2Air received the message.
Example: 1/1/2009 03:00:00PM
shortcode
stringrequired
in query
Your short code the message was sent to.
Example: 27126
subject
stringoptional
in query
The MMS subject.
Example: demo mms
baseurl
stringoptional
in query
Where the message's files are stored. Join it with each file name in attachments to download a file.
Example: http://mms.wire2air.com/mms/mmsinbox/
attachments
stringoptional
in query
Comma-separated file names.
Example: 0.smil,1.jpg,2.txt
keyword
stringoptional
in query
The keyword the message was sent with. Shown in the previous example request but not in its parameter list.
Example: @demomms

An example request, URL-encoded:

Request from Wire2Air
GET /wire2air/inbound-mms?mobilenumber=12125551234&rcvd=1%2F1%2F2009%2003%3A00%3A00PM&shortcode=27126&subject=demo%20mms&baseurl=http%3A%2F%2Fmms.wire2air.com%2Fmms%2Fmmsinbox%2F&attachments=0.smil%2C1.jpg%2C2.txt&keyword=%40demomms HTTP/1.1
Host: your-server.example

Examples

<?php
// Wire2Air's casing is unconfirmed, so accept both spellings.
function param(string $lower, string $mixed): string
{
    return $_GET[$lower] ?? $_GET[$mixed] ?? '';
}

$sender = param('mobilenumber', 'MobileNumber');
$subject = $_GET['subject'] ?? '';
$baseUrl = $_GET['baseurl'] ?? '';
$files = array_filter(array_map('trim', explode(',', $_GET['attachments'] ?? '')));

foreach ($files as $file) {
    // Download each file from $baseUrl . $file and store it.
    error_log('MMS file from ' . $sender . ': ' . $baseUrl . $file);
}
http_response_code(200);