Classes

ButtonTemplateBaseTemplate

Helps with creating of button template Instance of button template is returned by {Responder}

GenericTemplateButtonTemplate

Generic template utility

ReceiptTemplateBaseTemplate

Provides fluent interface to make nice Receipts Instance of button template is returned by {Responder}

Functions

encodePayload(payload)EncodedPayload

Encodes different types of payloads from designer snapshot to payload for chat Content is Base64 encoded.

Typedefs

MarkdownPayload
Payload : MarkdownPayload

Designer payload type

EncodedPayload
 

ButtonTemplate ⇐ BaseTemplate

Helps with creating of button template Instance of button template is returned by {Responder}

Kind: global class
Extends: BaseTemplate

 

buttonTemplate.urlButton(title, linkUrl, hasExtension, [webviewHeight], [onCloseAction], [onCloseData]) ⇒ this

Adds button. When hasExtension is set to true, url will contain hash like: #token=foo&senderId=23344

Kind: instance method of ButtonTemplate

ParamTypeDefaultDescription
titlestringbutton text
linkUrlstringbutton url
hasExtensionbooleanfalseincludes token in url
[webviewHeight]stringnullcompact
[onCloseAction]stringnullclose action for webview
[onCloseData]objectdata
 

buttonTemplate.postBackButton(title, action, [data], [setState]) ⇒ this

Adds button, which makes another action

Kind: instance method of ButtonTemplate

ParamTypeDefaultDescription
titlestringButton title
actionstringButton action (can be absolute or relative)
[data]object{}Action data
[setState]objectSetState data
 

buttonTemplate.attachmentButton(title, payload) ⇒ this

Adds button, which opens a popup with content on click.

Kind: instance method of ButtonTemplate

ParamType
titlestring
payloadPayload

Example

res.button('text')
.attachmentButton('button title', {
content: '# Heading 1',
contentType: 'text/markdown',
className: 'my-class-for-markdown'
})
.send();
 

buttonTemplate.shareButton() ⇒ this

Kind: instance method of ButtonTemplate

 

GenericTemplate ⇐ ButtonTemplate

Generic template utility

Kind: global class
Extends: ButtonTemplate

 

genericTemplate.addElement(title, [subtitle], [dontTranslate]) ⇒ this

Adds element to generic template

Kind: instance method of GenericTemplate

ParamTypeDefault
titlestring
[subtitle]stringnull
[dontTranslate]booleanfalse
 

genericTemplate.setElementActionShare() ⇒ this

Sets url of recently added element

Kind: instance method of GenericTemplate

 

genericTemplate.setElementActionPostback(action, [data], [setState]) ⇒ this

Sets url of recently added element

Kind: instance method of GenericTemplate

ParamTypeDefaultDescription
actionstringButton action (can be absolute or relative)
[data]object{}Action data
[setState]objectSetState data
 

genericTemplate.setElementImage(image) ⇒ this

Sets image of recently added element

Kind: instance method of GenericTemplate

ParamType
imagestring
 

genericTemplate.setElementAction(url, hasExtension, [webviewHeight])

Sets default action of recently added element

Kind: instance method of GenericTemplate

ParamTypeDefaultDescription
urlstringbutton url
hasExtensionbooleanfalseincludes token in url
[webviewHeight]stringnullcompact
 

genericTemplate.urlButton(title, linkUrl, hasExtension, [webviewHeight], [onCloseAction], [onCloseData]) ⇒ this

Adds button. When hasExtension is set to true, url will contain hash like: #token=foo&senderId=23344

Kind: instance method of GenericTemplate
Overrides: urlButton

ParamTypeDefaultDescription
titlestringbutton text
linkUrlstringbutton url
hasExtensionbooleanfalseincludes token in url
[webviewHeight]stringnullcompact
[onCloseAction]stringnullclose action for webview
[onCloseData]objectdata
 

genericTemplate.postBackButton(title, action, [data], [setState]) ⇒ this

Adds button, which makes another action

Kind: instance method of GenericTemplate
Overrides: postBackButton

ParamTypeDefaultDescription
titlestringButton title
actionstringButton action (can be absolute or relative)
[data]object{}Action data
[setState]objectSetState data
 

genericTemplate.attachmentButton(title, payload) ⇒ this

Adds button, which opens a popup with content on click.

Kind: instance method of GenericTemplate
Overrides: attachmentButton

ParamType
titlestring
payloadPayload

Example

res.button('text')
.attachmentButton('button title', {
content: '# Heading 1',
contentType: 'text/markdown',
className: 'my-class-for-markdown'
})
.send();
 

genericTemplate.shareButton() ⇒ this

Kind: instance method of GenericTemplate
Overrides: shareButton

 

ReceiptTemplate ⇐ BaseTemplate

Provides fluent interface to make nice Receipts Instance of button template is returned by {Responder}

Kind: global class
Extends: BaseTemplate

 

receiptTemplate.addElement(title, [price], [quantity], [image], [subtitle]) ⇒ this

Adds item to receipt

Kind: instance method of ReceiptTemplate

ParamTypeDefaultDescription
titlestring
[price]number0a item price
[quantity]numberamount of items
[image]stringnullimage of item
[subtitle]stringnulloptional subtitle
 

encodePayload(payload) ⇒ EncodedPayload

Encodes different types of payloads from designer snapshot to payload for chat Content is Base64 encoded.

Kind: global function

ParamType
payloadPayload
 

MarkdownPayload

Kind: global typedef
Properties

NameType
contentType"text/markdown"
contentstring
[className]string
 

Payload : MarkdownPayload

Designer payload type

Kind: global typedef

 

EncodedPayload

Kind: global typedef
Properties

NameType
contentstring
content_type"text/markdown"
[class_name]string