use of co.aurasphere.botmill.fb.model.api.upload.UploadAttachmentResponse in project fb-botmill by BotMill.
the class AnnotatedTemplatedBehaviourTest method catchTextAndReplyWithImage.
@FbBotMillController(eventType = FbBotMillEventType.MESSAGE, text = "Hi with Image!", caseSensitive = true)
public void catchTextAndReplyWithImage(MessageEnvelope envelope) {
//
UploadAttachmentResponse response = UploadApi.uploadAttachment(AttachmentType.IMAGE, "http://vignette2.wikia.nocookie.net/nickelodeon/images/2/27/Spongebob_PNG.png/revision/latest?cb=20120702055752");
String attachmentId = response.getAttachmentId();
reply(new AutoReply() {
@Override
public FbBotMillResponse createResponse(MessageEnvelope envelope) {
String greetingMessage = "Hey There! ";
return ReplyFactory.addTextMessageOnly(greetingMessage).build(envelope);
}
});
}
use of co.aurasphere.botmill.fb.model.api.upload.UploadAttachmentResponse in project fb-botmill by BotMill.
the class UploadApiTest method test.
@Test
public void test() {
UploadAttachmentResponse response = UploadApi.uploadAttachment(AttachmentType.IMAGE, "http://vignette2.wikia.nocookie.net/nickelodeon/images/2/27/Spongebob_PNG.png/revision/latest?cb=20120702055752");
String attachmentId = response.getAttachmentId();
Assert.notNull(attachmentId);
logger.info("Succesfully posted attachment with Upload Api (ID: [{}])", attachmentId);
}
Aggregations