src/main/java/com/messageyes/facebook/messenger/FacebookMessengerClient.java
public MessageResponse sendImageMessage(@NonNull String pageAccessToken, @NonNull String recipientId, @NonNull String imageURL) throws FacebookMessengerSendException {
        checkArgument(StringUtils.isNotBlank(pageAccessToken), "pageAccessToken cannot be blank");
        checkArgument(StringUtils.isNotBlank(recipientId), "recipientId cannot be blank");
        checkArgument(StringUtils.isNotBlank(imageURL), "imageURL cannot be blank");

        Attachment attachment = new Attachment();
        OutboundPayload payload = new OutboundPayload();
        payload.setUrl(imageURL);
        attachment.setPayload(payload);
        attachment.setType(ATTACHMENT_TYPE_IMAGE);

        OutboundMessage message = new OutboundMessage();
        message.setAttachment(attachment);

        return sendOutboundMessage(pageAccessToken, recipientId, message);
    }
/**
     * Sends an image attachment to the given recipient.
     *
     * https://developers.facebook.com/docs/messenger-platform/send-api-reference/image-attachment
     */
Sends an image attachment to the given recipient.
Sends an image attachment to the given recipient .
public MessageResponse sendImageMessage(@NonNull String pageAccessToken, @NonNull String recipientId, @NonNull String imageURL) throws FacebookMessengerSendException {
        checkArgument(StringUtils.isNotBlank(pageAccessToken), "pageAccessToken cannot be blank");
        checkArgument(StringUtils.isNotBlank(recipientId), "recipientId cannot be blank");
        checkArgument(StringUtils.isNotBlank(imageURL), "imageURL cannot be blank");
        Attachment attachment = new Attachment();
        OutboundPayload payload = new OutboundPayload();
        payload.setUrl(imageURL);
        attachment.setPayload(payload);
        attachment.setType(ATTACHMENT_TYPE_IMAGE);
        OutboundMessage message = new OutboundMessage();
        message.setAttachment(attachment);
        return sendOutboundMessage(pageAccessToken, recipientId, message);
    }
public MessageResponse sendImageMessage ( @ NonNull String pageAccessToken , @ NonNull String recipientId , @ NonNull String imageURL ) throws FacebookMessengerSendException { checkArgument ( StringUtils . isNotBlank ( pageAccessToken ) , "pageAccessToken cannot be blank" ) ; checkArgument ( StringUtils . isNotBlank ( recipientId ) , "recipientId cannot be blank" ) ; checkArgument ( StringUtils . isNotBlank ( imageURL ) , "imageURL cannot be blank" ) ; Attachment attachment = new Attachment ( ) ; OutboundPayload payload = new OutboundPayload ( ) ; payload . setUrl ( imageURL ) ; attachment . setPayload ( payload ) ; attachment . setType ( ATTACHMENT_TYPE_IMAGE ) ; OutboundMessage message = new OutboundMessage ( ) ; message . setAttachment ( attachment ) ; return sendOutboundMessage ( pageAccessToken , recipientId , message ) ; }
Sends an image attachment to the given recipient.
Sends an image attachment to the given recipient .