Graph API Version

Canvas Button

Reading

A button inside the canvas

Example

use FacebookAds\Api;
use FacebookAds\Http\RequestInterface;

$params = array(
  'fields' => array(
    'action',
    'id',
    'name',
    'rich_text',
  ),
);

$data = Api::instance()->call(
  '/' . <CANVAS_BUTTON_ID>,
  RequestInterface::METHOD_GET,
  $params)->getContent();
curl -G \
  --data-urlencode 'fields=[ 
    "action", 
    "id", 
    "name", 
    "rich_text" 
  ]' \
  -d 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.11/<CANVAS_BUTTON_ID>

Parameters

This endpoint doesn't have any parameters.

Fields

FieldDescription
id
numeric string

The id of the element

action
CanvasOpenURLAction

The action associated with the button

background_color
string

Color of the button background

bottom_padding
numeric string

The padding below the element

button_color
string

Color of the button

button_style
enum

The style of the button

deep_link
string

Deep link destination only for mobile apps (used for mobile install or engagement ads, and app link is supported)

element_type
enum

The type of the element

font_family
string

The font family

font_size
numeric string

The size of the font for the text

line_height
numeric string

The line height of the text

name
string

The name of the element

rich_text

The text inside the button

text_alignment
enum

The alignment of the text

text_color
string

The color of the text

top_padding
numeric string

The padding above the element

Error Codes

ErrorDescription
100Invalid parameter

Creating

You can't perform this operation on this endpoint.

Updating

You can update a CanvasButton by making a POST request to /{canvas_button_id}.

Parameters

ParameterDescription
background_color
string

Background color of the button

bottom_padding
float

The padding below the button

button_color
string

The color of the button

button_style
enum {BUTTON_OUTLINE, BUTTON_FILLED}

The style of the button

deep_link
string

Deep link destination only for mobile apps (used for mobile install or engagement ads and app link is supported)

font_family
string

The font family of the text on the button

font_size
int64

The size of the font for the text on the button

line_height
float

The line height of the text on the button

name
string

Name of the button

open_url_action
Object

the destination url after user clicks the button, by setting this, the canvas button will have action with OPEN URL type

rich_text
Object

The text inside the button

text_alignment
enum {LEFT, CENTER, RIGHT}

The alignment of the text on the button

text_color
string

The color of the text on the button

top_padding
float

The padding above the button

Return Type

This endpoint supports read-after-write and will read the node to which you POSTed.
Struct {
success: bool,
}

Error Codes

ErrorDescription
100Invalid parameter

Deleting

You can delete a CanvasButton by making a DELETE request to /{canvas_button_id}.

Parameters

This endpoint doesn't have any parameters.

Return Type

Struct {
success: bool,
}

Error Codes

ErrorDescription
100Invalid parameter