Hamed Kamrava
Hamed Kamrava

Reputation: 12847

How to create a Webhook server like Telegram Webhook

I need to create a Webhook server like Telegram Webhook server.

I googled it but didn't find any resources!

I'm not talking about receiving Webhook requests. I'm talking about creating a complete Webhook server to send HTTP POST requests to specific URLs. And our clients could receive the requests in their URLs by :

$response = file_get_contents('php://input');

Any helps would be great appreciated.

P.S:

Sorry for my bad English.

Upvotes: 0

Views: 933

Answers (2)

Hiren Makwana
Hiren Makwana

Reputation: 2156

you can try Captain Hook laravel package, which provides you to add webhook to your laravel application

Upvotes: 1

Paul
Paul

Reputation: 89

What a webhook actually does is nothing more than sending a request. The most easy way to set this up is by using Guzzle (https://packagist.org/packages/guzzlehttp/guzzle).

What you need to set up is on your side a script which decides what url to call, when that happens, just create the post request via guzzle.

$postData = [];
$client = new GuzzleHttp\Client();
$response = $client->request('POST', $url, $postData);

Upvotes: 0

Related Questions