Postgresql functions as a backend (p.3: Send SMS from the function)

pip3 install requests
pip3 install requests-oauthlib
create or replace function sm_send_sms(phone text, msg text)
returns bool as $W$
from requests_oauthlib import OAuth1Session
import sys
key = '**<YOUR_KEY>**'
secret = '**<YOUR_SECRET>**'
gwapi = OAuth1Session(key, client_secret=secret)
req = {
'sender': 'MYAPP',
'message': msg,
'recipients': [{'msisdn': phone}],
res ='', json=req)
return res
$W$ language plpython3u parallel safe;

select sm_send_sms('357666666','Buy cool stuff!');*/



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store