Reputation: 37
I want to verify a phone-number in Twilio by sending a link with parameters.The value of the last parameter is the code Twilio Verification object generates. I've created a service with a simple friendly name. But the link I want to send to the user, must be made for each verification: So I've tried to use the method .setCustomFriendlyName(link), but I get: Invalid parameter: FriendlyName. It has 45 characters. So I replaced the link with "Test". Then I get: Custom friendly name not allowed. I'm not able to find relevant information about this in the docs, or anywhere else ... Could someone help, please ?
import com.twilio.Twilio;
import com.twilio.rest.verify.v2.service.Verification;
public class TwilioAdministration {
public static final String TWILIO_ACCOUNT_SID = "ACxxxxx";
public static final String TWILIO_AUTH_TOKEN = "xxxxxx";
public static final String TWILIO_VERIFY_SERVICE = "VAxxxxx";
public static void main(String[] args) {
try {
Twilio.init(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN);
String verifyUrl = "https://aaaaa.shortcm.li/AlQvb71=I&2=24&3=";
Verification.creator(TWILIO_VERIFY_SERVICE,"+nnnnnnnnn",
"sms").setCustomFriendlyName(verifyUrl).create();
}catch(Exception ex) {
System.out.println(ex.getMessage());
}
}
}
Upvotes: 1
Views: 575
Reputation: 37
I saw somewhere that only numbers that was going to send sms, needed to be verified. My numbers are only receivers. So I rather checked the numbers with lookup and tested the type returned. Problem solved.
Upvotes: 1