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
want to send SMS using Microsoft SQL Server's store Procedure
Tags: sms and text messaging
Dec 17, 2018 at 5:21am   •   5 replies  •  0 likes
office-after-office

we want to send SMS using Microsoft SQL Server's store Procedure, plz. guide me if there is any sample code available ?

5 Answers
answered on Nov 20, 2019 at 12:54am  

 0
answered on Nov 20, 2019 at 3:35am  

Hi Jeevi,

Why are you posting this types of links in this forum.


 0
answered on Dec 18, 2018 at 3:15am  
Hi, thx for your reply, we are using Microsoft SQL server database, where we have a table with all the phone numbers to send SMS, (each SMS is unique to that number),

we want to build a DB job to automate this, below is the sample code which we are going to using ,

it will be helpful if you provide us all the steps (e.g. API to login and get the token so that token we will use in SMS API )
 
--- below is the sql sample code, this is working fine if I login manually and collect the token from browser trace/debugger 

Declare @Object as Int;
Declare @ResponseText as Varchar(8000);
DECLARE @reqHead AS VARCHAR(8000) = 
'{"Authorization": "U0pDMTFQMDFQQVMwMHxBQUF3NlMxZlNtZ1NCZEF5NTJrd1BnOFZkOWhhdlVnZkdGamVTeVpTTGxWdjhscmY4ZHN0NjlvQm1Lc0poVkZZbXNsNF9QWWRPMEVYNEV2UTBjM2U1NkM0MFk0SDhFeUVhUkhIczcycTVONm13MjNxcV9xVFkxUHA1cXZjWmZLMXEzcDBXaWdqNm4zdllvLUUyT1ZCSHExZmRvRFJIWVlnYXBKR1htc2JrZ0dWemVmQTRfLXU3WEUtSngwbTRLNzhIeDRKVVN6ZkR6NnRpUjIybjZmLU12cmN8VjVqczBRfFVEdzVrQ3BLbFduOTZFbzZ6c1d6QkF8QUE"}'

DECLARE @Body AS VARCHAR(8000) = 
'{
    "from": {"phoneNumber": "+17xxxxxxxx1"},
    "to": [{"phoneNumber": "+152xxxxxxxx4"}],
    "text": "Hello, Jack"
}'  
-- Code Snippet  MSXML2.ServerXMLHttp     MSXML2.XMLHTTP
Exec sp_OACreate 'MSXML2.ServerXMLHttp', @Object OUT;
Exec sp_OAMethod @Object, 'open', NULL, 'post','https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/extension/~/sms', 'false'
EXEC sp_OAMethod @Object, 'setRequestHeader', @reqHead, 'Content-Type', 'application/json'
Exec sp_OAMethod @Object, 'send', null, @body
Exec sp_OAMethod @Object, 'responseText', @ResponseText OUTPUT

Select @ResponseText

Exec sp_OADestroy @Object




 0
answered on Dec 17, 2018 at 10:38am  
Hi,

I am not sure how do you exactly want to send SMS with MS SQL store procedure, which is a database environment. Can you explain more details how and what you want to achieve?

Meanwhile, check this tutorial to learn how you could implement an A2P SMS application. 

Hope this helps,

+ Phong

 0



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