public function toArray() { $payload_name = $this->type == ButtonType::Web || $this->type == ButtonType::AccountLink ? 'url' : 'payload'; if ($this->type == ButtonType::AccountLink) { return ['type' => $this->type, 'url' => $this->payload]; } if ($this->type == ButtonType::AccountUnlink) { return ['type' => $this->type]; } if ($this->is_webview) { $result = ['type' => $this->type, $payload_name => $this->payload, 'title' => MessengerUtils::checkStringLengthAndEncoding($this->title, 320, 'UTF-8'), 'webview_height_ratio' => $this->webview_height_ratio]; if ($this->is_webview_extended) { $result['messenger_extensions'] = true; if (!is_null($this->fallback_url)) { $result['fallback_url'] = $this->fallback_url; } } return $result; } return ['type' => $this->type, $payload_name => $this->payload, 'title' => MessengerUtils::checkStringLengthAndEncoding($this->title, 320, 'UTF-8')]; }
public function removeWhitelistedDomain(array $domains) { return $this->api->callApi('me/thread_settings', ['setting_type' => 'domain_whitelisting', 'whitelisted_domains' => MessengerUtils::checkArraySize($domains, 10), 'domain_action_type' => 'remove']); }
public function toArray() { $this->checkRecipient(); return ['recipient' => ['id' => $this->recipient_id], 'message' => ['attachment' => ['type' => 'template', 'payload' => ['template_type' => 'generic', 'elements' => MessengerUtils::checkArraySize($this->cards, 10)]]]]; }
public function toArray() { $this->checkRecipient(); return ['recipient' => ['id' => $this->recipient_id], 'message' => ['attachment' => ['type' => 'template', 'payload' => ['template_type' => 'button', 'text' => MessengerUtils::checkStringLengthAndEncoding($this->text, 320, 'UTF-8'), 'buttons' => MessengerUtils::checkArraySize($this->buttons, 3)]]]]; }
public function toArray() { //check all buttons for titles! return ['title' => MessengerUtils::checkStringLength($this->title, 80), 'item_url' => $this->item_url, 'image_url' => $this->image_url, 'subtitle' => MessengerUtils::checkStringLength($this->subtitle, 80), 'buttons' => MessengerUtils::checkArraySize($this->buttons, 3)]; }
public function toArray() { $this->checkRecipient(); return ['recipient' => ['id' => $this->recipient_id], 'message' => ['text' => MessengerUtils::checkStringLengthAndEncoding($this->text, 320, 'UTF-8'), 'quick_replies' => MessengerUtils::checkArraySize($this->replies, 10)]]; }