Sorry, you need to enable JavaScript to visit this website.

You are here

PHP SDK for sendMMS

2 posts / 0 new
Last post

Eibhlis's picture
by Eibhlis

PHP SDK for sendMMS
We are experiencing issues implementing the sendMMS call via PHP   We did provision a number , and were able to mimic the same request in the "Try it Out" section and successfully get an MMS however using the SDK we have not been able to do this....   But I have three questions 1. I think the issue is in the SDK provided for php, it forms the request and alters the type to be redeclared as "type\/gif" not "type/gif"   We get a type Error when we are debugging the SDK, at some point it interprets type declared as image/gif to be image \/gif and alters the request params to be   "MMSContent": {         "type": "image\/gif",     ApiException 500 and the message                           {                         "status":"500",                                 "code":"TECH-ERR",                                 "message":"Technical error : Execution of JSPayloadSanityChecks failed with error: Javascript runtime error: \"TypeError: Cannot read property \"type\" from undefined. (JS.PayloadSanityChecks.js:82)\" : An error has occurred while processing your request, please refer to API Docs for summary on the issue"                           }       2. Alphaheaders are not resolved, so "From" parameter is ignored., when left out, the error not provisioned is encountered when set to an alphanumeric string like a company name , it is ignored and delivered from the provisioned number.   3. Bearer and token call needs to be added to the swagger Try It Out so that the try it out will work, otherwise you cant really try it out with oAuth2.0 , could add Security credentials to the definitions and access token parameter to the request 

DeveloperSteve's picture
by DeveloperSteve

Hi Eibhlis, 

Hi Eibhlis, 

We have just deployed a version of the php sdk that will fix this, check out (or git pull)

This is the sample code i was using to test on ....

$config = Telstra_Messaging\Configuration::getDefaultConfiguration()->setAccessToken($result['access_token']);

$apiInstance = new Telstra_Messaging\Api\MessagingApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),

$path = 'image1.png';
$type = pathinfo($path, PATHINFO_EXTENSION);
$data = file_get_contents($path);
$base64 = base64_encode($data);

$mmsImg = array(
	    'type' => 'image/'.$type,
	    'filename' => 'image.'.$type,
	    'payload' => $base64

$payload = array(
        'to' => '0400000000',
	    'subject' => 'This is a subject line',
        'mms_content' => [$mmsImg]

$body = new \Telstra_Messaging\Model\SendMmsRequest($payload);

$result = $apiInstance->sendMMS($body);


Log in or register to post comments