Skip to main content
The First Step
December 17, 2018
Question

want to send SMS using Microsoft SQL Server's store Procedure

  • December 17, 2018
  • 9 replies
  • 5445 views

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

9 replies

PhongVu
Community Manager
Community Manager
December 17, 2018
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
The First Step
December 18, 2018
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



Participating Frequently
November 3, 2019

Excellent information. Very useful to everyone and thanks for sharing this.

https://www.wikitechy.com/hosting/kenya/shared-web-hosting

https://www.wikitechy.com/hosting/dominican-republic/web-hosting

https://www.wikitechy.com/hosting/dominican-republic/web-hosting/hosting/jordan/web-hosting

https://www.wikitechy.com/hosting/dominican-republic/web-hosting/hosting/kazakhstan/web-hosting

https://www.wikitechy.com/hosting/dominican-republic/web-hosting/hosting/korea/

https://www.wikitechy.com/hosting/dominican-republic/web-hosting/hosting/timor-lestes/

https://www.wikitechy.com/hosting/dominican-republic/web-hosting/hosting/costa-rica/web-hosting

https://www.wikitechy.com/hosting/dominican-republic/web-hosting/hosting/hong-kong/web-hosting

https://www.wikitechy.com/hosting/dominican-republic/web-hosting/hosting/slovakia/web-hosting

https://www.wikitechy.com/hosting/dominican-republic/web-hosting/hosting/bahrain/web-hosting

https://www.wikitechy.com/hosting/dominican-republic/web-hosting/hosting/india/

https://www.wikitechy.com/hosting/dominican-republic/web-hosting/hosting/iran/web-hosting

https://www.wikitechy.com/hosting/dominican-republic/web-hosting/hosting/moldova/web-hosting

https://www.wikitechy.com/hosting/dominican-republic/web-hosting/hosting/turkey/web-hosting


Participating Frequently
November 3, 2019

Thanks for sharing this blog. really nice and useful for me

https://www.wikitechy.com/technology/hack-wifi-passwords-ubuntu/

https://www.wikitechy.com/interview-questions/paramatrix-interview-questions-and-answers

https://www.wikitechy.com/online-videos/company-interview-questions-and-answers/

https://www.wikitechy.com/interview-questions/paramatrix-interview-questions-and-answers

https://www.wikitechy.com/resume/bca-fresher-resume-sample/

https://www.wikitechy.com/tutorials/ethical-hacking/whatsapp-hacking-tutorial/unlock-from-whatsapp

https://www.wikitechy.com/interview-questions/verbal-ability/tenses-and-articles/she-most-of-her-time-to-music

https://www.wikitechy.com/forum/d/354-solved-json-python-json-loads-shows-valueerror-extra-data

https://www.wikitechy.com/technology/hack-android-iphone-pc-connected-wifi-network/

https://www.wikitechy.com/technology/hack-linksys-router-wifi/


Participating Frequently
November 20, 2019
The First Step
November 20, 2019

Hi Jeevi,

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