question

Roger Samuel avatar image
Roger Samuel asked Roger Samuel answered

Error sending an MMSmessage

When I try to send an MMS message I get:

{ "errorCode" : "InvalidParameter", "message" : "Parameter [attachments] value is invalid.", "errors" : [ { "errorCode" : "CMN-101", "message" : "Parameter [attachments] value is invalid.", "parameterName" : "attachments" } ], "parameterName" : "attachments" }

Does anyone know what's wrong? I have the JSON formatted properly and it worked in the sandbox. Now it does not work in production.


errors
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Phong Vu avatar image
Phong Vu answered

Post some code where you created the POST body.

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Roger Samuel avatar image
Roger Samuel answered

{

"to": [{"phoneNumber": "#arguments.to#"}],

"from": {"phoneNumber": "#arguments.from#}"},

"text": "#arguments.message#",

"attachments":["#img#"]

}

img=data:image/jpeg;name=file.jpg;base64,[base64data]

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Anirban avatar image
Anirban answered

Are you using any RC SDK to send message?

If yes, then please put you code sample.

Also, the mms api reference you will get it here

https://community.ringcentral.com/questions/103211/error-sending-an-mmsmessage.html

Can you please try once from here and see if this is working for you? You can get the correct json request generated here

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Roger Samuel avatar image
Roger Samuel answered

No SDK just a HTTP request. The format is correct and it worked fine in the sandbox. Is there some kind of MMS permission that has to be added to the sending number?

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Phong Vu avatar image
Phong Vu answered

Since you are not using any SDK, I cannot help providing you with sample code.

But you can call this API to read a user's phone numbers and detect if the number is MMS enabled (under the 'features' array "MmsSender".

You should also double check if you have set the server for production "platform.ringcentral.com", the POST request header and make sure that you read and create the attachments properly in your production environment. Many developers have such problems when they run their app okay in their local machine but fails when deployed and run on their remote server.

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Roger Samuel avatar image
Roger Samuel answered Phong Vu commented

The full JSON I am sending is:

{ "to": [{"phoneNumber": "+1xxxxxxxxxx"}], "from": {"phoneNumber": "+1xxxxxxxxxx}"}, "text": "Test SMS", "attachments":["data:image/jpeg;name=overlay.png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAEUlEQVR42mNgYGC4iQMPnAQAw/QehVmSyckAAAAASUVORK5CYII="] }

I am sending it to

https://platform.ringcentral.com/restapi/v1.0/account/~/extension/~/mms
Content-Type: application/json
Accept: application/json

1 comment
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Phong Vu avatar image Phong Vu ♦♦ commented ·

Did you read the phone number features?

Did you also set the content-type header?

header 'content-type: multipart/form-data'
0 Likes 0 ·
Roger Samuel avatar image
Roger Samuel answered Roger Samuel commented

I did not request the read permission when I setup the App so I can't access the endpoint.

When I change the content type to multipart/form-data I get a different error:


{ "message" : "Bad Request", "errors" : [ ] }





2 comments
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Phong Vu avatar image Phong Vu ♦♦ commented ·

What is your app client id?

0 Likes 0 ·
Roger Samuel avatar image Roger Samuel Phong Vu ♦♦ commented ·

i3w9C0UwSQSnPcgoLOxaZw

0 Likes 0 ·
Phong Vu avatar image
Phong Vu answered

I added the missing permission to your app so you can now read the phone-number API to detect number features.

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Roger Samuel avatar image
Roger Samuel answered Phong Vu commented

It still says:
In order to call this API endpoint, application needs to have [ReadAccounts] permission

1 comment
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Phong Vu avatar image Phong Vu ♦♦ commented ·

Sorry, I forgot to submit the change. Should be ok to call the API in a min.

0 Likes 0 ·
Roger Samuel avatar image
Roger Samuel answered

And also, if I determine that the number does not have MMS access, how would I turn that on?


1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys