com.greenapi.client.examples.SendFileByUrlExample Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of whatsapp-api-client-java Show documentation
Show all versions of whatsapp-api-client-java Show documentation
WhatsApp java client Green API
package com.greenapi.client.examples;
import com.greenapi.client.pkg.models.request.OutgoingFileByUrl;
import com.greenapi.client.pkg.api.GreenApi;
import lombok.extern.log4j.Log4j2;
import java.util.Objects;
@Log4j2
public class SendFileByUrlExample {
private void sendFileByUrlExample(GreenApi greenApi) {
var response = greenApi.sending.sendFileByUrl(OutgoingFileByUrl.builder()
.urlFile("https://go.dev/blog/go-brand/Go-Logo/SVG/Go-Logo_Blue.svg")
.fileName("Go-Logo_Blue.svg")
.chatId("[email protected]")
.build());
if (response.getStatusCode().isError()) {
log.warn("message sending is failed");
}
log.info("message sent, id: " + Objects.requireNonNull(response.getBody()).getIdMessage());
}
}