2012-09-19 2 views
2

수신자가 SMS 수신 여부를보고 날씨를 얻으려고합니까? 내가 SMS를 보낼 수 있어요하지만 Twilio 내가 다음 을 지정한 URL을 다시 호출하지 않는 것은 내 코드입니다 : -배달 보고서 Java를 사용하는 Twilio Rest API에서

// Create a rest client 
    TwilioRestClient client = new TwilioRestClient(com.main.Constants.ACCOUNT_SID,     com.main.Constants.AUTH_TOKEN); 

// Get the main account (The one we used to authenticate the client 
    Account mainAccount = client.getAccount(); 

// Get all accounts including sub accounts 
    AccountList accountList = client.getAccounts(); 

    // Send an sms 
    SmsFactory smsFactory = mainAccount.getSmsFactory(); 
    Map<String, String> smsParams = new HashMap<String, String>(); 
    smsParams.put("To", number); // Replace with a valid phone 

    // number in your account 
    smsParams.put("From", com.main.Constants.FROM); // Replace with a valid         

    smsParams.put("StatusCallback", com.main.Constants.CALLBACKURL); 

    smsParams.put("Body", "Token : " + token); 

    sms = smsFactory.create(smsParams); 
+0

안녕하세요, 콜백 URL이 SMS 상태와 함께 맞아야합니다. http://backurler.heroku.com/와 같이 들어오는 HTTP 요청을 확인할 수있는 사이트에 설정하여 콜백 URL이 히트되지 않았는지 확인할 수 있습니까? –

답변

2

Twilio는 SMS 메시지의 상태로 callback URL에 요청을해야한다 .

들어오는 HTTP 요청을 확인할 수있는 사이트 (예 : http://uncurler.heroku.com/)로 테스트 SMS를 보내 콜백 URL을 실제로 적중시키지 않았는지 확인할 수 있습니까? 그런 다음 Uncurler에서 샘플 페이지를 새로 고치고 인바운드 HTTP 요청을 찾으십시오.

아웃 바운드 SMS 메시지가 거부되어 Twilio가 배달을 위해 메시지를 대기열에 올리지 않을 수도 있습니다. smsFactory.create() 행에서 발생하는 예외를 확인하고 오류 메시지를 확인하십시오.

+0

좋은 답변 그래서 +1, 당신은 http://uncurler.heroku.com/을 사용하는 방법을 기쁘게 해드릴 수 있습니다.> 나는 또한 SMS를 보내기 위해 twilio를 사용하고 SMS가 목적지에 도달했는지 여부를 알고 싶었습니다. – SpringLearner

관련 문제