php-trello-api
php-trello-api copied to clipboard
Webhook handle return null
In webhook handle I can't get the "action" data.
I've checked this$request->getContent()
it has data
But, in this in code $request->get('action')
return null
I try it this way I got 500 Internal Server Error
if (!$this->isTrelloWebhook($request)) {
return;
}
$action = json_decode($request->getContent(), true)['action'];
Anyone have and idea how to catch the request?
Thank you
What the API method Get or Post
In trello it use POST in receiving. btw this is in laravel
try to move your route to api.php instead of web.php and use (any) instead of (post) and try again
Thanks, I will try it
I'm still received null value in $request->get('action')
both web and api.
Here in screenshot the data is available

Maybe I did wrong implementation. What is the best way to implement in laravel? I did it in AppServiceProvider.php
try
$input = $request->all();
\Log::info(json_encode($input['action']['data']));
Thanks for helping guys,
For this $input = $request->all();
it return error from HttpFoundation
Error: Call to undefined method Symfony\Component\HttpFoundation\Request::all()
you need to import Illuminate\Http\Request
Hi still isn't working inside
public function handleWebhook(Request $request = null)
{
if (!$request) {
$request = Request::createFromGlobals();
}
if (!$this->isTrelloWebhook($request) || !$action = $request->get('action')) {
return;
}
****
****
}
Illuminate\Http\Request
will on passing the $request
e.g
$this->service->handleWebhook($request);
But, new issues found :)

-- I think this api need to be update.
Thanks.