NowSMS/MMS Proprietary URL Submission

The Now SMS & MMS Proprietary format for submission of an MMS message is the interface that is used by the “Send MMS Message” form in the web menu interface of the gateway.

To submit a message via this interface, a user account must be specified on the “SMS Users” configuration dialog.

To submit it the same way that the “Send MMS Message” form does in the gateway’s web menu interface, you need to do an HTTP POST in the “multipart/form-data” MIME type.

Basically, when you POST, it would look something like this:

POST / HTTP/1.0
Accept: */*
Content-type: multipart/form-data; boundary=”–boundary-border–”
Content-length: xxxxx (size of content part of post)
Authorization: username:password (base64 encoded)

—-boundary-border–
Content-Disposition: form-data; name=“PhoneNumber”

+448080148324
—-boundary-border–
Content-Disposition: form-data; name=”MMSFrom”

sender@domain (or +38484753009)
—-boundary-border–
Content-Disposition: form-data; name=”MMSSubject”

Message Subject
—-boundary-border–
Content-Disposition: form-data; name=”MMSText”

An optional text part of the message.
—-boundary-border–
Content-Disposition: form-data; name=”MMSFile”; filename=”original-filename.ext”
Content-type: Mime/Type

File data goes here
—-boundary-border—-

The content-type for the overall message is “multipart/form-data”. As with other multipart MIME encoding, you must include a boundary that separates the multiple parts of the message.

It is very important to set the Content-length: field to specify the length of the multipart content that follows (this is how the server knows your HTTP post is complete).

The Authorization header specifies the username and password used to login to the gateway. It is in the format “username:password” and is Base64 encoded.

Then, the content has a part for each form variable.

The “PhoneNumber” variable is required, it is the phone number of the message recipient.

The “MMSFrom” variable is optional. It is the “From:” address to be used in the MMS message. (If sending a pre-compiled MMS message, this is used for the notification only.)

The “MMSSubject” variable is optional. It is the “Subject” line used in the MMS message. (If sending a pre-compiled MMS message, this is used for the notification only.)

The “MMSText” variable is optional. It contains a text part of the message.

The “MMSFile” variable is optional, and can be repeated multiple times. It contains binary file content for an uploaded file. If you’re sending a pre-compiled MMS file, you’d only include the “MMSFile” variable once. If you’re sending a message for the gateway to compile, you could include each of the individual message parts as a separate instance of the “MMSFile” variable.

As an alternative to using the HTTP POST, if the content of the MMS message already exists on a web server, the “MMSFile” variable can be specified as a URL instead of the actual file content. In this case, the message can be submitted to the gateway with an HTTP GET request, instead of requiring HTTP POST. For example:

http://127.0.0.1:8800/?PhoneNumber=xxxxxx&MMSFrom=sender@domain&MMSSubject=Message+Subject&MMSText=An+optional+text+part+of+the+message&MMSFile=http://www.nowsms.com/media/logo.gif

The variables are the same as described above, except that in a GET request, the “MMSFile” variable must point to a URL. As with the POST request, the “MMSFile” variable can be repeated to specify multiple content files.

Note: If authentication is enabled for the web interface, any application submitting a message must supply a user name and password for access. This user name and password refers to an account defined on the “SMS Users” configuration dialog. The application can either include the user name and password in an “Authorization:” header using “HTTP Basic Authentication”, or it can include “&User=xxxx&Password=xxxx” parameters within the URL request.

Note: A PHP script that simplifies the process of generating an HTTP POST for submitting MMS messages to NowSMS can be found in the section titled Send MMS Message with PHP.