2. RingCentral deals with different kind of APIs that offers reliable VoIP
calling, web meetings, fax, & more features over cloud communication
with reliability, security, and quality .
In this blog we will discuss about different APIs related to SMS and
messaging and it’s various status.
As we already seen in our previous posts, we can start by logging into
our RingCentral developer portal and need to do is create a new
application by hitting the CreateApp button in right top:
3. Following details need to be provided:
• Application Name: The name of your app.
• Organization Name: The name of your organization.
• Description: Any text describing your app and should contain
minimum 20 characters.
4. We have choose Desktop (Mac/Windows/Other) and authorization
includes password flow in above image. Once the API created, we can
see the details like client id, client secret etc in the dashboard:
5. Testing API via postman
Creates and sends a new message: You can send SMS messages
simultaneously to different recipients up to 50 requests per minute.
The API for sending SMS is:
POST
https://platform.devtest.ringcentral.com/restapi/v1.0/account/accou
ntId/extension/extensionId/sms
6.
7. If you see the messageStatus here, you can it’s Queued:
8. • If status for at least one recipient is ‘Queued‘, then ‘Queued‘ value is
returned which means the message hasn’t reached the SMS provider.
If the SMS provider is temporarily unavailable, the message will be
‘Queued‘ and the carrier will continue to retry.
• Reading the message status: Every message we send has a message
id. We can read the message state by using the following API:
• GET https://platform.devtest.ringcentral.com/restapi/v1.0/account
/~/extension/~/message-store/<message id>
9.
10. By this time, if you check the message state it will show ‘Delivered’ as
above, which means the message is reached the recipient.
If the mobile phone we are sending is switched off, the carrier will tries
to deliver within 48 hours and if unsuccessful then it will expires the
message and in that case we will get the status as ‘DeliveryFailed‘.
11. Deleting the message: We can use the same API and delete the
message. for example, now if we use DELETE method as follows:
DELETE https://platform.devtest.ringcentral.com/restapi/v1.0/accou
nt/~/extension/~/message-store/<message id>
12. The API has deleted the message from message store. It will not
provide any response.
Now if we do a GET and check the response we will see: availability is
‘Deleted‘ :
13. Message availability status. Message in ‘Deleted‘ state is still preserved
with all its attachments and can be restored.
14. Modifying readStatus of message: We can use the same API with PUT
method and can modify the readstatus of the message. There is
2 readStatus: Read, Unread
We can modify as below:
PUT https://platform.devtest.ringcentral.com/restapi/v1.0/account/~
/extension/~/message-store/<message id>
15.
16. We see previous slide, we have modified the SMS readStatus into
unread.
If we go back to
the GET https://platform.devtest.ringcentral.com/restapi/v1.0/accou
nt/~/extension/~/message-store/<message id> and check
the readStatus of message we will get as below:
17.
18. Listing Valid SMS Numbers: To determine which numbers a user can
use to send and receive SMS, retrieve the user’s list of phone numbers
from the extension/phone number endpoint and then filter by
numbers with the SmsSender and/or MmsSender feature.
19.
20. Reading SMS Content: We can also read the actual message or SMS
content and can see what the user had send using following API:
GET https://platform.devtest.ringcentral.com/restapi/v1.0/account/~
/extension/~/message-store/<message id>/content/<attachment id>
21. Conclusion
So at the end we can see that RingCentral not only provide API to just send a
SMS message, but also provides APIs to get the SMS status, content and even
delete a SMS message, retrieve it, change it’d read status and so on. It
provides such a variety of features that we can actually control almost all the
messaging feature end to end.
We can integrate all these features of API in our application which can be a
web application or an android or even a standalone running in any
programming language either Java, PHP, javascript etc and control all the
messaging features at a single place!
We will discuss some more RingCentral APIs and it’s feature in next post.