Skip to content

Latest commit

 

History

History
193 lines (125 loc) · 6.35 KB

ogelementbuilder.md

File metadata and controls

193 lines (125 loc) · 6.35 KB

@aiteq/messenger-bot > OgElementBuilder

Class: OgElementBuilder

Helps to create an Open Graph Element.

Hierarchy

ButtonHoldingBuilder

↳ OgElementBuilder

Index

Constructors

Methods


Constructors

new OgElementBuilder(url)

Creates an instance of ElementBuilder.

Parameters:

Param Type Description
url string Open Uraph URL for the element

Returns: OgElementBuilder


Methods

addCallButton(title, phoneNumber)

Creates and adds a Call Button.

Inherited from ButtonHoldingBuilder.

Parameters:

Param Type Description
title string title of the button, max length is 20 characters
phoneNumber string phone number, format must have "+" prefix followed by the country code, area code and local number (e.g. +16505551234)

Returns: this - for chaining


addExtensionButton(title, extension, [options])

Creates and adds a URL Button linking a Chat Extension.

Inherited from ButtonHoldingBuilder.

Parameters:

Param Type Description
title string a title of the button, max length is 20 characters
extension ChatExtension a Chat Extension to be opened when the button is tapped
options object

options object can contain:

Property Type Description
webviewHeightRatio HeightRatio optional height of the Webview
webviewShareButton boolean set to false to disable sharing in the Webview (e.g. for sensitive info)
fallbackUrl string URL to use on clients that don't support Messenger Extensions

Returns: this - for chaining


addLoginButton(url)

Creates and adds a Login Button.

Inherited from ButtonHoldingBuilder.

Parameters:

Param Type Description
url string authentication callback URL (must use HTTPS protocol)

Returns: this - for chaining


addLogoutButton()

Creates and adds a Logout Button.

Inherited from ButtonHoldingBuilder.

Returns: this - for chaining


addPostbackButton(title, id, [data])

Creates and adds a Postback Button.

Inherited from ButtonHoldingBuilder.

Parameters:

Param Type Description
title string a title of the button, max length is 20 characters
id string an identification of the postback
data string optional data to be send with postback

Returns: this - for chaining


addShareButton(builder)

Creates and adds a Share Button.

Inherited from ButtonHoldingBuilder.

Parameters:

Param Type Description
builder GenericTemplateMessageBuilder a generic template message builder

Returns: this - for chaining


addUrlButton(title, url, [options])

Creates and adds a URL Button.

Inherited from ButtonHoldingBuilder.

Parameters:

Param Type Description
title string a title of the button, max length is 20 characters
url string a URL to be opened in a mobile browser when the button is tapped
options object

options object can contain:

Property Type Description
webviewHeightRatio HeightRatio optional height of the Webview
messengerExtensions boolean must be true if using Messenger Extensions
webviewShareButton boolean set to false to disable sharing in the Webview (e.g. for sensitive info)
fallbackUrl string URL to use on clients that don't support Messenger Extensions

Returns: this - for chaining


setDefaultAction(defaultActionBuilder)

Set a Default Action for the Element.

Parameters:

Param Type Description
defaultActionBuilder DefaultActionBuilder

Returns: this - for chaining