Classes
- ButtonTemplate ⇐
BaseTemplate
Helps with creating of button template Instance of button template is returned by {Responder}
- GenericTemplate ⇐
ButtonTemplate
Generic template utility
- ReceiptTemplate ⇐
BaseTemplate
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
BaseTemplate
ButtonTemplate ⇐ Helps with creating of button template Instance of button template is returned by {Responder}
Kind: global class
Extends: BaseTemplate
- ButtonTemplate ⇐
BaseTemplate
this
buttonTemplate.urlButton(title, linkUrl, hasExtension, [webviewHeight], [onCloseAction], [onCloseData]) ⇒ Adds button. When hasExtension
is set to true
, url will contain hash like:
#token=foo&senderId=23344
Kind: instance method of ButtonTemplate
Param | Type | Default | Description |
---|---|---|---|
title | string | button text | |
linkUrl | string | button url | |
hasExtension | boolean | false | includes token in url |
[webviewHeight] | string | null | compact |
[onCloseAction] | string | null | close action for webview |
[onCloseData] | object | data |
this
buttonTemplate.postBackButton(title, action, [data], [setState]) ⇒ Adds button, which makes another action
Kind: instance method of ButtonTemplate
Param | Type | Default | Description |
---|---|---|---|
title | string | Button title | |
action | string | Button action (can be absolute or relative) | |
[data] | object | {} | Action data |
[setState] | object |
| SetState data |
this
buttonTemplate.attachmentButton(title, payload) ⇒ Adds button, which opens a popup with content on click.
Kind: instance method of ButtonTemplate
Param | Type |
---|---|
title | string |
payload | Payload |
Example
res.button('text').attachmentButton('button title', {content: '# Heading 1',contentType: 'text/markdown',className: 'my-class-for-markdown'}).send();
this
buttonTemplate.shareButton() ⇒ Kind: instance method of ButtonTemplate
ButtonTemplate
GenericTemplate ⇐ Generic template utility
Kind: global class
Extends: ButtonTemplate
- GenericTemplate ⇐
ButtonTemplate
- .addElement(title, [subtitle], [dontTranslate]) ⇒
this
- .setElementActionShare() ⇒
this
- .setElementActionPostback(action, [data], [setState]) ⇒
this
- .setElementImage(image) ⇒
this
- .setElementAction(url, hasExtension, [webviewHeight])
- .urlButton(title, linkUrl, hasExtension, [webviewHeight], [onCloseAction], [onCloseData]) ⇒
this
- .postBackButton(title, action, [data], [setState]) ⇒
this
- .attachmentButton(title, payload) ⇒
this
- .shareButton() ⇒
this
- .addElement(title, [subtitle], [dontTranslate]) ⇒
this
genericTemplate.addElement(title, [subtitle], [dontTranslate]) ⇒ Adds element to generic template
Kind: instance method of GenericTemplate
Param | Type | Default |
---|---|---|
title | string | |
[subtitle] | string | null |
[dontTranslate] | boolean | false |
this
genericTemplate.setElementActionShare() ⇒ Sets url of recently added element
Kind: instance method of GenericTemplate
this
genericTemplate.setElementActionPostback(action, [data], [setState]) ⇒ Sets url of recently added element
Kind: instance method of GenericTemplate
Param | Type | Default | Description |
---|---|---|---|
action | string | Button action (can be absolute or relative) | |
[data] | object | {} | Action data |
[setState] | object |
| SetState data |
this
genericTemplate.setElementImage(image) ⇒ Sets image of recently added element
Kind: instance method of GenericTemplate
Param | Type |
---|---|
image | string |
genericTemplate.setElementAction(url, hasExtension, [webviewHeight])
Sets default action of recently added element
Kind: instance method of GenericTemplate
Param | Type | Default | Description |
---|---|---|---|
url | string | button url | |
hasExtension | boolean | false | includes token in url |
[webviewHeight] | string | null | compact |
this
genericTemplate.urlButton(title, linkUrl, hasExtension, [webviewHeight], [onCloseAction], [onCloseData]) ⇒ Adds button. When hasExtension
is set to true
, url will contain hash like:
#token=foo&senderId=23344
Kind: instance method of GenericTemplate
Overrides: urlButton
Param | Type | Default | Description |
---|---|---|---|
title | string | button text | |
linkUrl | string | button url | |
hasExtension | boolean | false | includes token in url |
[webviewHeight] | string | null | compact |
[onCloseAction] | string | null | close action for webview |
[onCloseData] | object | data |
this
genericTemplate.postBackButton(title, action, [data], [setState]) ⇒ Adds button, which makes another action
Kind: instance method of GenericTemplate
Overrides: postBackButton
Param | Type | Default | Description |
---|---|---|---|
title | string | Button title | |
action | string | Button action (can be absolute or relative) | |
[data] | object | {} | Action data |
[setState] | object |
| SetState data |
this
genericTemplate.attachmentButton(title, payload) ⇒ Adds button, which opens a popup with content on click.
Kind: instance method of GenericTemplate
Overrides: attachmentButton
Param | Type |
---|---|
title | string |
payload | Payload |
Example
res.button('text').attachmentButton('button title', {content: '# Heading 1',contentType: 'text/markdown',className: 'my-class-for-markdown'}).send();
this
genericTemplate.shareButton() ⇒ Kind: instance method of GenericTemplate
Overrides: shareButton
BaseTemplate
ReceiptTemplate ⇐ Provides fluent interface to make nice Receipts Instance of button template is returned by {Responder}
Kind: global class
Extends: BaseTemplate
this
receiptTemplate.addElement(title, [price], [quantity], [image], [subtitle]) ⇒ Adds item to receipt
Kind: instance method of ReceiptTemplate
Param | Type | Default | Description |
---|---|---|---|
title | string | ||
[price] | number | 0 | a item price |
[quantity] | number |
| amount of items |
[image] | string | null | image of item |
[subtitle] | string | null | optional subtitle |
EncodedPayload
encodePayload(payload) ⇒ Encodes different types of payloads from designer snapshot to payload for chat Content is Base64 encoded.
Kind: global function
Param | Type |
---|---|
payload | Payload |
MarkdownPayload
Kind: global typedef
Properties
Name | Type |
---|---|
contentType | "text/markdown" |
content | string |
[className] | string |
MarkdownPayload
Payload : Designer payload type
Kind: global typedef
EncodedPayload
Kind: global typedef
Properties
Name | Type |
---|---|
content | string |
content_type | "text/markdown" |
[class_name] | string |