-
Notifications
You must be signed in to change notification settings - Fork 50
API Requests & Responses
Setiawan edited this page Aug 18, 2020
·
9 revisions
For convenience, we may pass a TelegramObject to the first argument of all the wrapped methods which contain the target method payload. Its fields will be sent as payload.
example:
$payload = new TelegramObject();
$payload->peer = '@your_username';
$payload->message = 'Your Message';
Messages::sendMessage($payload);
The TelegramObject's constructor also accepting array arguments:
$payload = new TelegramObject([
'peer' = '@your_username',
'message' = 'Your Message'
]);
Messages::sendMessage($payload);
All wrapped methods return a TelegramObject instance which wrapping the array response from Telegram api into an "object notated" response. The TelegramObject implements the Illuminate\Contracts\Support\Arrayable
contract.
examples:
$response = Messages::sendMessage('@your_username', 'Your Message');
dd($response->toArray());
- Messages (WIP)