#Need help in Tawk.to API

26 messages · Page 1 of 1 (latest)

empty kelp
#

@brittle bramble You've just shared your API key, so anyone can now access your account and do any action the key allows. I'd really suggest taking a look at some best practices first, like storing credentials in an .env file and then accessing it through config (https://laravel.com/docs/10.x/configuration). That way your credentials won't end up in git history and you won't (accidentally) share your private keys with the world.

terse dagger
#

#1085457875595431966 message

You mentioned you were using POST method, but nothing has changed.

empty kelp
#

Ah, nice, the key was already shared earlier

grand veldt
#

My key now

empty kelp
#

@brittle bramble I'll remove your posts unless you update both posts and remove the key. Not that that would have much of an effect, because key has probably already been saved by others. So, revoke the key and store your credentials properly

terse dagger
#

#general message

#1085457875595431966 message

told him to remove the key, but he is fine with that.

empty kelp
#

Alright, well they're unresponsive. Best course of action is to delete the posts shrug

brittle bramble
#

sorry, I was away

terse dagger
brittle bramble
#

How can I edit my post now?

grand veldt
#

Right click it and then "Edit message"

brittle bramble
#

Here is my updated laravel controller code :

<?php
namespace App\Http\Controllers;

use Illuminate\Http\Request;
use GuzzleHttp\Client;

class KB extends Controller
{


    public function getKnowledgebaseArticles()
    {

        $client = new Client([
                'base_uri' => 'https://api.tawk.to/v1/knowledge-base.category.list-article',
                'headers' => [
                    'Authorization' => 'Bearer API_KEY',
                    'Content-Type' => 'application/json',
                    'Accept' => 'application/json'
                ]
            ]);

        $response = $client->request('POST', 'knowledge-base.list-article');

        if ($response->getStatusCode() == 200
        ) {
            $data = json_decode($response->getBody(), true);
            $articles = $data['articles'];
            dd($articles);
            
        } else {
            // Handle the error
        }
                        
        }
}
#

@terse dagger

#

showing this error : Client error: POST https://api.tawk.to/v1/knowledge-base.list-article resulted in a 404 Not Found response: {"ok":false,"error":"not_found"}

serene harness
brittle bramble
#

Here is my actual laravel controller code :

<?php
namespace App\Http\Controllers;

use Illuminate\Http\Request;
use GuzzleHttp\Client;

class KB extends Controller
{


    public function getKnowledgebaseArticles()
    {

        $client = new Client([
                'base_uri' => 'https://api.tawk.to/v1/',
                'headers' => [
                    'Authorization' => 'Bearer API_KEY',
                    'Content-Type' => 'application/json',
                    'Accept' => 'application/json'
                ]
            ]);

        $response = $client->request('POST', 'knowledge-base.list-article');

        if ($response->getStatusCode() == 200
        ) {
            $data = json_decode($response->getBody(), true);
            $articles = $data['articles'];
            dd($articles);
            
        } else {
            // Handle the error
        }
                        
        }
}
#

I have removed the api_key.

serene harness
#

So what’s the full error you get with the above code?

brittle bramble
#

Client error: POST https://api.tawk.to/v1/knowledge-base.list-article resulted in a 404 Not Found response: {"ok":false,"error":"not_found"}

empty kelp
#

So, the URL you're requesting isn't found, check the docs if you're using the correct URL

serene harness
#

Yeah. I mean, you’re getting a 404. From a server. Which means you’re requesting a URL that doesn’t exist. So is that path correct? Are they really uses dots in a URI like that? Because I’d be surprised if they were.

brittle bramble
#

Please check the doc.

terse dagger
#

please remove the credentials

terse dagger