All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.greenapi.client.examples.SendMessageExample Maven / Gradle / Ivy

There is a newer version: 0.1.8
Show newest version
package com.greenapi.client.examples;

import com.greenapi.client.pkg.models.request.OutgoingMessage;
import com.greenapi.client.pkg.api.GreenApi;
import lombok.extern.log4j.Log4j2;

@Log4j2
public class SendMessageExample {
    private void sendMessageExample(GreenApi greenApi) {
        var message = greenApi.sending.sendMessage(
                OutgoingMessage.builder()
                    .chatId("[email protected]")
                    .message("hola a todos")
                    .build());

        if (message.getStatusCode().is2xxSuccessful()) {
            log.info(message.getBody());
        } else {
            log.warn("Message isn't sent, status code: " + message.getStatusCode());
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy