You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.0 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. package in.gov.chennaicorporation.gccoffice.callcenter.service;
  2. import java.net.HttpURLConnection;
  3. import java.net.URL;
  4. import org.springframework.stereotype.Service;
  5. import org.springframework.web.client.RestTemplate;
  6. @Service
  7. public class WhatsappMsgService {
  8. public String sendMsg(String msgUrl) {
  9. String response ="";
  10. try{
  11. HttpURLConnection connection =null;
  12. URL url = new URL(msgUrl);
  13. connection = (HttpURLConnection) url.openConnection();
  14. connection.setRequestMethod("GET");
  15. int responseCode = connection.getResponseCode();
  16. response=responseCode+"";
  17. System.out.println("Response Code: " + responseCode);
  18. }catch (Exception e){
  19. e.printStackTrace();
  20. }
  21. return response;
  22. }
  23. public String sendSMS(String SMS_Url) {
  24. RestTemplate restTemplate = new RestTemplate();
  25. String response =restTemplate.getForObject(SMS_Url,String.class);
  26. return response;
  27. }
  28. }