Search in sources :

Example 1 with FbBotMillMessageResponse

use of co.aurasphere.botmill.fb.model.outcoming.message.FbBotMillMessageResponse in project fb-botmill by BotMill.

the class AttachmentMessageBuilder method build.

/**
	 * {@inheritDoc} Returns a response containing an {@link Attachment}.
	 */
public FbBotMillResponse build(MessageEnvelope envelope) {
    User recipient = getRecipient(envelope);
    Message message = new AttachmentMessage(attachment);
    message.setQuickReplies(quickReplies);
    return new FbBotMillMessageResponse(recipient, message);
}
Also used : User(co.aurasphere.botmill.fb.model.base.User) FbBotMillMessageResponse(co.aurasphere.botmill.fb.model.outcoming.message.FbBotMillMessageResponse) Message(co.aurasphere.botmill.fb.model.outcoming.message.Message) AttachmentMessage(co.aurasphere.botmill.fb.model.outcoming.message.AttachmentMessage) AttachmentMessage(co.aurasphere.botmill.fb.model.outcoming.message.AttachmentMessage)

Example 2 with FbBotMillMessageResponse

use of co.aurasphere.botmill.fb.model.outcoming.message.FbBotMillMessageResponse in project fb-botmill by BotMill.

the class TextMessageBuilder method build.

/**
	 * {@inheritDoc} Returns a response containing a plain text message.
	 */
public FbBotMillResponse build(MessageEnvelope envelope) {
    User recipient = getRecipient(envelope);
    Message message = new TextMessage(messageText);
    message.setQuickReplies(quickReplies);
    return new FbBotMillMessageResponse(recipient, message);
}
Also used : User(co.aurasphere.botmill.fb.model.base.User) FbBotMillMessageResponse(co.aurasphere.botmill.fb.model.outcoming.message.FbBotMillMessageResponse) Message(co.aurasphere.botmill.fb.model.outcoming.message.Message) TextMessage(co.aurasphere.botmill.fb.model.outcoming.message.TextMessage) TextMessage(co.aurasphere.botmill.fb.model.outcoming.message.TextMessage)

Example 3 with FbBotMillMessageResponse

use of co.aurasphere.botmill.fb.model.outcoming.message.FbBotMillMessageResponse in project fb-botmill by BotMill.

the class UploadApi method uploadAttachment.

/**
	 * Method to upload an attachment to Facebook's server in order to use it
	 * later. Requires the pages_messaging permission.
	 * 
	 * @param attachmentType
	 *            the type of attachment to upload to Facebook. Please notice
	 *            that currently Facebook supports only image, audio, video and
	 *            file attachments.
	 * @param attachmentUrl
	 *            the URL of the attachment to upload to Facebook.
	 * @return nonexpiring ID for the attachment.
	 */
public static UploadAttachmentResponse uploadAttachment(AttachmentType attachmentType, String attachmentUrl) {
    AttachmentPayload payload = new AttachmentPayload(attachmentUrl, true);
    Attachment attachment = new Attachment(attachmentType, payload);
    AttachmentMessage message = new AttachmentMessage(attachment);
    FbBotMillMessageResponse toSend = new FbBotMillMessageResponse(null, message);
    return FbBotMillNetworkController.postUploadAttachment(toSend);
}
Also used : FbBotMillMessageResponse(co.aurasphere.botmill.fb.model.outcoming.message.FbBotMillMessageResponse) AttachmentMessage(co.aurasphere.botmill.fb.model.outcoming.message.AttachmentMessage) Attachment(co.aurasphere.botmill.fb.model.base.Attachment) AttachmentPayload(co.aurasphere.botmill.fb.model.outcoming.payload.AttachmentPayload)

Aggregations

FbBotMillMessageResponse (co.aurasphere.botmill.fb.model.outcoming.message.FbBotMillMessageResponse)3 User (co.aurasphere.botmill.fb.model.base.User)2 AttachmentMessage (co.aurasphere.botmill.fb.model.outcoming.message.AttachmentMessage)2 Message (co.aurasphere.botmill.fb.model.outcoming.message.Message)2 Attachment (co.aurasphere.botmill.fb.model.base.Attachment)1 TextMessage (co.aurasphere.botmill.fb.model.outcoming.message.TextMessage)1 AttachmentPayload (co.aurasphere.botmill.fb.model.outcoming.payload.AttachmentPayload)1