PHP Class pimax\FbBotApp

Show file Open project: pimax/fb-messenger-php

Protected Properties

Property Type Description
$apiUrl string FB Messenger API Url
$token null | string

Public Methods

Method Description
__construct ( string $token ) FbBotApp constructor.
deletePersistentMenu ( ) : array Remove Persistent Menu
send ( Message $message ) : array Send Message
setPersistentMenu ( MessageButton[] $buttons ) : array Set Persistent Menu
userProfile ( integer $id, string $fields = 'first_name,last_name,profile_pic,locale,timezone,gender' ) : UserProfile Get User Profile Info

Protected Methods

Method Description
call ( string $url, array $data, string $type = self::TYPE_POST ) : array Request to API

Method Details

__construct() public method

FbBotApp constructor.
public __construct ( string $token )
$token string

call() protected method

Request to API
protected call ( string $url, array $data, string $type = self::TYPE_POST ) : array
$url string
$data array
$type string Type of request (GET|POST|DELETE)
return array

deletePersistentMenu() public method

Remove Persistent Menu
See also: https://developers.facebook.com/docs/messenger-platform/thread-settings/persistent-menu
public deletePersistentMenu ( ) : array
return array

send() public method

Send Message
public send ( Message $message ) : array
$message pimax\Messages\Message
return array

setPersistentMenu() public method

Set Persistent Menu
See also: https://developers.facebook.com/docs/messenger-platform/thread-settings/persistent-menu
public setPersistentMenu ( MessageButton[] $buttons ) : array
$buttons pimax\Messages\MessageButton[]
return array

userProfile() public method

Get User Profile Info
public userProfile ( integer $id, string $fields = 'first_name,last_name,profile_pic,locale,timezone,gender' ) : UserProfile
$id integer
$fields string
return UserProfile

Property Details

$apiUrl protected property

FB Messenger API Url
protected string $apiUrl
return string

$token protected property

protected null|string $token
return null | string