laravel-notification-channels / webhook

Webhook notifications channel for Laravel
https://laravel-notification-channels.com
MIT License
170 stars 61 forks source link

Empty body #37

Closed ilvalerione closed 4 years ago

ilvalerione commented 4 years ago

Hi, I'm trying to use this channel, but the body of the post request generated via Guzzle steel empty.

This is my message:

WebhookMessage::create()
            ->data([
                'event' => 'My event name',
                'payload' => [
                    'foo' => 'bar',
                ],
            ])
            ->userAgent("Webhook-Notification-Channel")
            ->header('X-Signature', $notifiable->signature);

I'm passing a simple array in the data method that is a JSON-encodable value.

Anyone stumble in this behaviour? Thanks

dungnh commented 2 years ago

@ilvalerione Did you resolve this issue? I'm getting the same issue. The requested data is an empty array.

ilvalerione commented 2 years ago

Hi @dungnh I extended the class to support multiple URLs so I rewrited the guzzle request by myself. I don't know if the original package works properly.

dungnh commented 2 years ago

Hi @ilvalerione , Thanks for your response. I saw that I need to add Content-Type to the header as Application/JSON like this: ->header('Content-Type', 'application/json')