Monday, April 3, 2017

Guzzle to ryver api

Hello guys i've been pulling my hair for this problem. I'm accessing an api from ryver to send post chat messages for automated notification. I'm following this doc https://support.ryver.com/chatmessage-api/ and I'm using laravel 5.1 with Guzzle and here's my code if it helps

$client = new Client();
        $postData = \GuzzleHttp\json_encode(['JSON Payload' => ['body' => 'test123']]);



        $options = [
            'json' => $postData
        ];

        $request = $client->post('https://somecompany.ryver.com/api/1/odata.svc/workrooms(1099207)/Chat.PostMessage()', $options);
        $request->setHeader('Content-Type', 'application/json');
        $request->setHeader('Accept', 'application/json');
        $request->setHeader('Authorization', 'Basic Base64codehere');

        $response = $request->send();

It always returns a [status code] 400, Please help :( Thank you and have a great day!



via Keannu Alforque Atilano

Advertisement