question

Darrin Bonikowsky avatar image
Darrin Bonikowsky asked Phong Vu commented

Automatically and intelligently processing SMS attachments?

Hi there.

Newbie here, so please be kind :)

Is it theoretically possible to setup a phone number with an associated process in place to receive SMS messages that contain attachments, and to use the sending mobile number to automatically save those attachments to a specific local folder related to said sending number?

Thanks!

sms and text messaging
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 ·

I don't really understand your question. Can you explain in a use case scenario?

0 Likes 0 ·
Darrin Bonikowsky avatar image
Darrin Bonikowsky answered

You bet.

Let's say that I had a project management app that multiple users subscribed to and as part of that app's functionality I wanted to allow my users to send project photos from "the field" as SMS messages from their phones and have those project photos be automatically associated to their project in the PM software. If I had a database of known, identified sending phone numbers, I'd like to receive these SMS messages at one common number for all users and then, based on a match on the sending phone number, automatically save the project photo and associate it to the appropriate user.

Does that help?

Thanks.

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

Thanks for the clarification! Not really clear but here is the solution based on what I guess.

1. You need to have an extension with a direct number, which is for receiving SMS/MMS from users on "the field".

2. You build an app that can receive those messages from the users on "the field". Authenticate your app with login credentials of the user extension who owns the direct phone number (mentioned in 1.). Then you need to subscribe for the /instant?type=SMS event notification in order to get notified when an incoming message arrives. Here is the sample of an MMS message event payload. See comments inline.

{
  "uuid": "5089369288242083258",
  "event": "/restapi/v1.0/account/80964xxxx/extension/6249888xxxx/message-store/instant?type=SMS",
  "timestamp": "2022-08-31T03:14:20.085Z",
  "subscriptionId": "2ba333cd-97ba-47d9-9ce0-5166b2525c74",
  "ownerId": "6249888xxxx",
  "body": {
    "id": "1795801671016",
    "to": [
      {
                  
        // This is the direct phone number of the extension mentioned in 1.
        "phoneNumber": "+1209248xxxx",
        "name": "Manager",
        "location": "Modesto, CA",
        "target": true
      }
    ],
    "from": {
                  
      // This is the phone number of a user on "the field", use this to identify who sent this message
      "phoneNumber": "+1209284xxxx",
      "name": "Agent 120",
      "location": "Modesto, CA",
      "phoneNumberInfo": {
        "countryCode": "1",
        "nationalDestinationCode": "209",
        "subscriberNumber": "2845360"
      }
    },
    "type": "SMS",
    "creationTime": "2022-08-31T03:14:20.080Z",
    "lastModifiedTime": "2022-08-31T03:14:20.080Z",
    "readStatus": "Unread",
    "priority": "Normal",
    "attachments": [
      {
        "id": "1795801671016",
        "type": "Text",
        "contentType": "text/plain"
      },
      {
        "id": "50708686xxxx",
        // This is the media attachment info. Use the uri with a valid access token to access/download the media content
        "type": "MmsAttachment",
        "uri": "https://media.ringcentral.com/restapi/v1.0/account/80964xxxx/extension/6249888xxxx/message-store/1795801671016/content/507086866016",
        "contentType": "image/png",
        "size": 16254
      }
    ],
    "direction": "Inbound",
    "availability": "Alive",
        // This is the text message
    "subject": "Hello there",
    "messageStatus": "Received",
    "conversation": {
      "id": "6288164535269838686"
    }
  }
}

Parse the event payload and use the data to add to your database.

1 |3000

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

Darrin Bonikowsky avatar image
Darrin Bonikowsky answered Phong Vu commented

Thanks @Phong Vu. Much appreciated. Certainly seems promising.

I've also reached out to RingCentral Sales as I'm currently terribly naive on them and their offering, related pricing, etc., but if anyone here cares to offer any insight I'm all ears! I'm a bit more familiar with how this might work with Twilio, where if someone sends us an SMS with an attachment, we can have a webhook attached to our recipient phone number whereby we could access that attachment (i.e. save it somewhere specific "locally") based on the sender's phone number. Would this sort of be the same with RingCentral? Could the sample JSON that Phong posted above be automatically sent via a webhook based on the receipt of an SMS at our recipient phone number? We could certainly build a webpage to consume and parse the JSON, which could allow us to download attachments and write to our database as appropriate.

Thanks!

3 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 ·

Check the subscription API reference to learn more. We support PubNub and WebHooks transport methods.


0 Likes 0 ·
Darrin Bonikowsky avatar image Darrin Bonikowsky Phong Vu ♦♦ commented ·

Thanks again @Phong Vu. So, just to try to confirm, we'd subscribe to a RingCentral plan - at a glance it would likely have to be Premium to allow for the required webhooks, is that correct? - and that plan would include one or more phone numbers that could be configured to automatically fire these webhooks any time an SMS was received? Since this is all we'd likely be doing with our RingCentral subscription, I assume that a single user subscription would suffice.

0 Likes 0 ·
Phong Vu avatar image Phong Vu ♦♦ Darrin Bonikowsky commented ·

Yes, the Premium and Enterprise plans include access to the API platform out of the box. The Essentials and Standard plans do not include access to the API platform. But it depends on the number of users and digital lines you would have in your plan and your use case, they can make an exceptional grant to access the platform for those plans. Contact your RingCentral account manager for more.

If you would like to try the API platform without a production plan to see how it work and if that solves your problem, feel free to sign up for a free developer account (sandbox account and completely free) and start the development.

0 Likes 0 ·
Darrin Bonikowsky avatar image
Darrin Bonikowsky answered Phong Vu commented

A Sales Development Rep @ RingCentral said that what I wanted to do would be "...wildly complex but is potentially doable." I'm certainly not interested in anything wildly complex as that also typically means wildly expensive, but unless I'm underthinking this somehow, it sure doesn't seem that complex to me.

I'd like to be able to assign a webhook to a recipient phone number that would automatically fire off whenever an SMS was received at that number. I'd like that webhook to contain the details of the SMS, including the message itself, the sending mobile number, as well as download url's for any attachments (typically photos). That's it really. What I do or don't do on my end with the details parsed from the webhook is then up to me and not part of the SMS solution that I need to procure.

Am I underthinking this? If so, what part of what I'm asking of an SMS solution is the "stumbling block"?

Thanks!

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 ·

This is confusing me. Don't bring what a sales rep told you to this discussion. Instead, ask your technical questions then I will answer. I don't know why you go circle again talking about the same thing I already explained above. You need to get notified and access to the message content and metadata and that was shown in the payload example above.

0 Likes 0 ·

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