DEPRECATED - MMS API Gateway: Receive Images & Audio

Receive MMS messages into your own systems and software.

Choose an API

Overview

You can configure any of your Textlocal inboxes to send a notification to a URL whenever you receive an MMS. To enable message notifications, simply enter your URL into the inbox settings within Messenger.

Code Examples

As all we are doing is sending you variables, it's quite difficult to show code examples, however the following might help - including, in some languages, examples of writing the variables to a database and/or file:

			    		<?php
			    		$from = $_REQUEST['from'];
			    		$to = $_REQUEST['to'];
			    		$body = $_REQUEST['body'];
			    		$subject = $_REQUEST['subject'];
			    		$files = explode(',', $_REQUEST['files']);
			    		if(sizeof($files) > 0)
			    		{
			    			// Loop through files
			    			foreach($files as $file)
			    			{
			    				// Get file name
			    				$filename = basename($file);
			    		
			    				// Download file
			    				$ch = curl_init($file);
			    				$fp = fopen('images/'.$filename, 'wb');
			    				curl_setopt($ch, CURLOPT_FILE, $fp);
			    				curl_setopt($ch, CURLOPT_HEADER, 0);
			    				curl_exec($ch);
			    				curl_close($ch);
			    				fclose($fp);
			    			}
			    		}
			    		?>
			    	

API Parameter Details

Once you've configured your Textlocal inbox settings to forward to your URL, the following variables will be sent as POST variables:

from The sender's mobile phone number in international format. For example, 447XXX XXXXXX numbers will be formatted as UK.
subject The subject line of the MMS message. If you have a keyword on a shortcode, this field will be blank.
to The inbound number the message was sent to.
body The full message content.
files A comma-delimited list of URLs to the MMS media sent in the message. This will normally include a text file containing the message content.
Top