user2940296
user2940296

Reputation: 153

The method creator(PhoneNumber, PhoneNumber, String) is undefined for the type Message

sdk i'm using- twilio-java-sdk-7.0.0-rc-10-jar-with-dependencies.jar
I'm working on eclipse luna and ibm bluemix is the server.
the code-

String ACCOUNT_SID = "ACa0c22e33e95dcaf9a0b1370748855769";
String AUTH_TOKEN = "[auth-token]"; //pasted the correct token here
    Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

     Message.creator(new PhoneNumber("+91"+rsa.getString(2)),
                    new PhoneNumber("+12014904147"), 
                    "Congrats, "+rsa.getString(3)+"! Your booking for the event has been confirmed. You will be contacted by the event representatives soon.")
                    .create();

the error- The method creator(PhoneNumber, PhoneNumber, String) is undefined for the type Message.
I try to solve this error by replacing creator with create. The arguments are of type (String,PhoneNumber,PhoneNumber,String). I'm not sure what the first String is for. Please help me resolve this issue. Thanks!

Upvotes: 2

Views: 648

Answers (1)

Erwin Bolwidt
Erwin Bolwidt

Reputation: 31269

There are 6 classes called Message in Twilio. See the Javadoc.

You need to figure out which one to use and add an import statement that imports the right one.

You probably want to import com.twilio.rest.api.v2010.account.Message; as this Message class has a creator method that fits your invocation:

static MessageCreator creator(PhoneNumber to, PhoneNumber from, String body)

Upvotes: 3

Related Questions