0

I need to send a whatsapp message with a link in its content using twilio.

Here is my code:

Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
Message message = Message.creator(
    new PhoneNumber("whatsapp:" + phoneNumber),
    new PhoneNumber("whatsapp:" + PHONE_FROM),
    "Hello: http://www.google.com")
  .create();

How can I send a link on the body message. Please help!!

Hemant
  • 1,403
  • 2
  • 11
  • 21

1 Answers1

0

Use this creator method from MessageCreator class.

   /**
     * Create a MessageCreator to execute create.
     * 
     * @param to The phone number to receive the message
     * @param from The phone number that initiated the message
     * @param mediaUrl The media_url
     * @return MessageCreator capable of executing the create
     */
    public static MessageCreator creator(final com.twilio.type.PhoneNumber to, 
                                         final com.twilio.type.PhoneNumber from, 
                                         final List<URI> mediaUrl) {
        return new MessageCreator(to, from, mediaUrl);
    }

Also, checkout another question related to this problem.

Hemant
  • 1,403
  • 2
  • 11
  • 21