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
40 lines
1.0 KiB
package in.gov.chennaicorporation.gccoffice.callcenter.service;
|
|
|
|
import java.net.HttpURLConnection;
|
|
import java.net.URL;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
@Service
|
|
public class WhatsappMsgService {
|
|
|
|
|
|
public String sendMsg(String msgUrl) {
|
|
|
|
String response ="";
|
|
try{
|
|
HttpURLConnection connection =null;
|
|
|
|
URL url = new URL(msgUrl);
|
|
connection = (HttpURLConnection) url.openConnection();
|
|
connection.setRequestMethod("GET");
|
|
|
|
int responseCode = connection.getResponseCode();
|
|
response=responseCode+"";
|
|
System.out.println("Response Code: " + responseCode);
|
|
|
|
}catch (Exception e){
|
|
e.printStackTrace();
|
|
}
|
|
|
|
return response;
|
|
}
|
|
|
|
|
|
public String sendSMS(String SMS_Url) {
|
|
RestTemplate restTemplate = new RestTemplate();
|
|
String response =restTemplate.getForObject(SMS_Url,String.class);
|
|
return response;
|
|
}
|
|
}
|