traccar / traccar-sms-gateway

Traccar SMS Gateway for Android
GNU General Public License v3.0
638 stars 99 forks source link

How to send requests from HTTPS webapp #4

Open saikarthikp9 opened 3 years ago

saikarthikp9 commented 3 years ago

DESCRIPTION

What is the easiest way to send requests to this SMS gateway from a web app running on a cloud server? The webapp is on a different network from the SMS gateway.

davilatk commented 3 years ago

Only remplace the content whit out [ ]

POST //[UR IP AND PORT]/ HTTP/1.1 Host: http AUTHORIZATION: [THE APP KEY] Content-Type: application/json Content-Length: 62

{ "to":"+5213333333333", "message":"Mensaje desde la API" }

image

tensor5g commented 1 year ago

cURL example: curl -X POST "http://<ip>:8082" -d '{"to": "+<tel>", "message": "<message>"}' -H "Authorization: <api key>"

If they are on different networks, you should use a site to site VPN to bridge the networks. That's something you'll have to solve on the network side rather than on the app side.

mtuchi commented 1 year ago

cURL example: curl -X POST "http://<ip>:8082" -d '{"to": "+<tel>", "message": "<message>"}' -H "Authorization: <api key>"

If they are on different networks, you should use a site to site VPN to bridge the networks. That's something you'll have to solve on the network side rather than on the app side.

Insightful answer, i am curios on how to setup the site to site VPN so that i will be able to make request from any web-app, I have tried using openvpn.com to setup the site to site connection but i don't know what i am doing. Can you share some guideline on how to setup site to site vpn connection using openvpn cloud

tensor5g commented 1 year ago

I've never used openvpn cloud so I'm not sure for that specifically. But your webapp would need to be running on a full vm instance so that you could install openvpn on the underlying OS. If you're using some sort of stripped down cloud service for web hosting, probably not an option. Cloudflare tunnels might be an option. That would open the sms service up to the internet using a connector, but it would be secured behind cloudflare and token authentication. I haven't done this myself either, but this should help: https://developers.cloudflare.com/cloudflare-one/connections/connect-apps

mtuchi commented 1 year ago

Thanks @tensor5g let me give it a try