OutgoingMessage

This class will help you compose sendable message objects.

Kind: global class

new OutgoingMessage([message])

Constructor to the OutgoingMessage class. Takes in an optional message object that it will use as its base to add the OutgoingMessage methods to. This constructor is not actually exposed in the public API. In order to instantiate an OutgoingMessage object, you'll need to use the createOutgoingMessage and createOutgoingMessageFor methods provided with all classes that inherit from BaseBot. There are static and non-static versions of both methods to make sure you can do so wherever as you wish

Param Type Description
[message] object the base object to convert into an OutgoingMessage object

outgoingMessage.addRecipientById(id) ⇒ OutgoinMessage

Adds recipient.id param to the OutgoingMessage object. This is most likely what you will want to do to add a recipient. Alternatively, you Can use addRecipientByPhoneNumber if the platform you are sending the message to supports that.

Kind: instance method of OutgoingMessage
Returns: OutgoinMessage - returns this object to allow for chaining of methods.

Param Type Description
id string the id to add to the OutgoingMessage object

outgoingMessage.addRecipientByPhoneNumber(phoneNumber) ⇒ OutgoinMessage

Adds recipient.phone_number param to the OutgoingMessage object. You might prefer to add a recipient by id rather. This is achieved via addRecipientById

Kind: instance method of OutgoingMessage
Returns: OutgoinMessage - returns this object to allow for chaining of methods.

Param Type Description
phoneNumber string the phone number to add to the OutgoingMessage object

outgoingMessage.removeRecipient() ⇒ OutgoinMessage

removes the recipient param from the OutgoingMessage object. This will remove the object wether it was set with a phone number or an id

Kind: instance method of OutgoingMessage
Returns: OutgoinMessage - returns this object to allow for chaining of methods.

outgoingMessage.addText(text) ⇒ OutgoinMessage

Adds message.text to the OutgoingMessage

Kind: instance method of OutgoingMessage
Returns: OutgoinMessage - returns this object to allow for chaining of methods.

Param Type Description
text string the text to add to the OutgoingMessage object

outgoingMessage.removeText() ⇒ OutgoinMessage

Removes the message.text param from the OutgoingMessage object.

Kind: instance method of OutgoingMessage
Returns: OutgoinMessage - returns this object to allow for chaining of methods.

outgoingMessage.addAttachment(attachment) ⇒ OutgoinMessage

Adds message.attachment to the OutgoingMessage. If you want to add an attachment simply from a type and a url, have a look at: addAttachmentFromUrl

Kind: instance method of OutgoingMessage
Returns: OutgoinMessage - returns this object to allow for chaining of methods.

Param Type Description
attachment object valid messenger type attachment that can be formatted by the platforms your bot uses

outgoingMessage.addAttachmentFromUrl(type, url) ⇒ OutgoinMessage

Adds message.attachment from a type and url without requiring you to provide the whole attachment object. If you want to add an attachment using a full object, use addAttachment.

Kind: instance method of OutgoingMessage
Returns: OutgoinMessage - returns this object to allow for chaining of methods.

Param Type Description
type string the attachment type (audio, video, image, file)
url string the url of the attachment.

outgoingMessage.removeAttachment() ⇒ OutgoinMessage

Removes message.attachment param from the OutgoingMessage object.

Kind: instance method of OutgoingMessage
Returns: OutgoinMessage - returns this object to allow for chaining of methods.

outgoingMessage.addQuickReplies(quickReplies) ⇒ OutgoinMessage

Adds message.quick_replies to the OutgoinMessage object. Use addPayloadLessQuickReplies if you just want to add quick replies from an array of titles

Kind: instance method of OutgoingMessage
Returns: OutgoinMessage - returns this object to allow for chaining of methods.

Param Type Description
quickReplies Array The quick replies objects to add to the OutgoingMessage

outgoingMessage.addPayloadLessQuickReplies(quickRepliesTitles) ⇒ OutgoinMessage

Adds message.quick_replies to the OutgoinMessage object from a simple array of quick replies titles.Use addQuickReplies if want to add quick replies from an quick reply objects

Kind: instance method of OutgoingMessage
Returns: OutgoinMessage - returns this object to allow for chaining of methods.

Param Type Description
quickRepliesTitles Array The titles of the quick replies objects to add to the OutgoingMessage

outgoingMessage.addLocationQuickReply() ⇒ OutgoinMessage

Adds a content_type: location message.quick_replies to the OutgoingMessage. Use this if the platform the bot class you are using is based on supports asking for the location to its users.

Kind: instance method of OutgoingMessage
Returns: OutgoinMessage - returns this object to allow for chaining of methods.

outgoingMessage.removeQuickReplies() ⇒ OutgoinMessage

Removes message.quick_replies param from the OutgoingMessage object.

Kind: instance method of OutgoingMessage
Returns: OutgoinMessage - returns this object to allow for chaining of methods.

outgoingMessage.addSenderAction(senderAction) ⇒ OutgoinMessage

Adds an arbitrary sender_action to the OutgoinMessage

Kind: instance method of OutgoingMessage
Returns: OutgoinMessage - returns this object to allow for chaining of methods.

Param Type Description
senderAction string Arbitrary sender action (typing_on, typing_off or mark_seens)

outgoingMessage.addTypingOnSenderAction() ⇒ OutgoinMessage

Adds sender_action: typing_on to the OutgoinMessage

Kind: instance method of OutgoingMessage
Returns: OutgoinMessage - returns this object to allow for chaining of methods.

outgoingMessage.addTypingOffSenderAction() ⇒ OutgoinMessage

Adds sender_action: typing_off to the OutgoinMessage

Kind: instance method of OutgoingMessage
Returns: OutgoinMessage - returns this object to allow for chaining of methods.

outgoingMessage.addMarkSeenSenderAction() ⇒ OutgoinMessage

Adds sender_action: mark_seen to the OutgoinMessage

Kind: instance method of OutgoingMessage
Returns: OutgoinMessage - returns this object to allow for chaining of methods.

outgoingMessage.removeSenderAction() ⇒ OutgoinMessage

Removes sender_action param from the OutgoingMessage object.

Kind: instance method of OutgoingMessage
Returns: OutgoinMessage - returns this object to allow for chaining of methods.

results matching ""

    No results matching ""