News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
Sending an MMS was a Bad Request
Tags: sending sms, message
Jul 10, 2022 at 9:38am   •   3 replies  •  0 likes
Khiem Nguyen

At the first, I received a response message like this:

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

and this is my request payload:

{
  "from":{"phoneNumber":"+19292561865"},
  "to":[{"phoneNumber":"+14707816202"}], 
  "text":"mms testing",
  "attachments":["data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAEBAQEBAQEBAQEBAQECAgMCAgICAgQDAwIDBQQFBQUEBAQFBgcGBQUHBgQEBgkGBwgICAgIBQYJCgkICgcICAj..."]
}
Content-type: multipart/mixed

I found out that I can use MmsSender with my account, too.

I, therefore, wonder whether I'm missing something or if there are any permissions I need to specify but haven't?

Content-Type:
multipart/mixed
2 Answers
answered on Oct 2, 2023 at 2:31pm  

I could get it to send the mms with text type files, but when I send images, I can only send a string, not a byte array. when I send a byte array it tells me that the attachment body is missing.


 0
answered on Jul 11, 2022 at 6:37am  

What programming language are you writing your code? Why don't you use one of the RingCentral SDKs?

Check this out to see how to use an SDK to send MMS messages. If you are using CURL, see the following sample code:

curl -X POST 'https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/extension/~/mms' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <valid-access-token' \
-F 'request={"from":{"phoneNumber":"+1312xxxyyyy"},"to":[{"phoneNumber":"+1650xxxyyyy"}],"text":"By CURLing"};type=application/json' \
-F 'attachment=@test3.png;type=image/png'

 0
on Jul 12, 2022 at 9:26am   •  0 likes

I did it. After checking out how the SDK works, I looked at my code and adjusted it using Blob with content-type=application/json. Then, the magic occurred.

Thanks

1657642961238.png

1657642850582.png

on Jul 11, 2022 at 12:08pm   •  0 likes

I got confused by the API Send MMS described attachments that are arrays and must be base64. So, the first question is, are array attachments and single attachments both correct?

And second, I want to try to use Postman to send MMS with data like down below. Will it work?

{
  "from":{"phoneNumber":"+1929xxxyyyy"},
  "to":[{"phoneNumber":"+1470xxxyyyy"}], 
  "text":"mms testing",
  "attachments":["data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAEBAQEBAQEBAQEBAQECAgMCAgICAgQDAwIDBQQFBQUEBAQFBgcGBQUHBgQEBgkGBwgICAgIBQYJCgkICgcICAj..."]
}
  1. Content-type: multipart/form-data

If not, could you suggest to me how to convert the upper JSON to Form-data in Postman or any way that can run with Postman?

Thanks



A new Community is coming to RingCentral!

Posts are currently read-only as we transition into our new platform.

We thank you for your patience
during this downtime.

Try Workflow Builder

Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!

Try RingCentral Workflow Builder

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us