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
ButtonTemplate ⇐ BaseTemplate
Helps with creating of button template Instance of button template is returned by {Responder}
Kind: global class
Extends: BaseTemplate
- ButtonTemplate ⇐
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
| 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 |
buttonTemplate.postBackButton(title, action, [data], [setState]) ⇒ this
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 |
buttonTemplate.attachmentButton(title, payload) ⇒ this
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();
buttonTemplate.shareButton() ⇒ this
Kind: instance method of ButtonTemplate
GenericTemplate ⇐ ButtonTemplate
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]) ⇒
genericTemplate.addElement(title, [subtitle], [dontTranslate]) ⇒ this
Adds element to generic template
Kind: instance method of GenericTemplate
| Param | Type | Default |
|---|---|---|
| title | string | |
| [subtitle] | string | null |
| [dontTranslate] | boolean | false |
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
| Param | Type | Default | Description |
|---|---|---|---|
| action | string | Button action (can be absolute or relative) | |
| [data] | object | {} | Action data |
| [setState] | object | | SetState data |
genericTemplate.setElementImage(image) ⇒ this
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 |
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
| 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 |
genericTemplate.postBackButton(title, action, [data], [setState]) ⇒ this
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 |
genericTemplate.attachmentButton(title, payload) ⇒ this
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();
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
| 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 |
encodePayload(payload) ⇒ EncodedPayload
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 |
Payload : MarkdownPayload
Designer payload type
Kind: global typedef
EncodedPayload
Kind: global typedef
Properties
| Name | Type |
|---|---|
| content | string |
| content_type | "text/markdown" |
| [class_name] | string |