How to Extract Assistant's Response from API Data Using PHP and cURL?

Hello, everyone!

I’m encountering an issue that I’ve been trying to resolve for a while, but I can’t seem to figure it out. Maybe it’s not as complex as it seems.

Using PHP and cURL, I’ve created an Assistant, a Thread, added a Message, initiated a Run, and fetched the Thread. Now, the $response variable contains the data, but I can’t extract the Assistant’s response from it.

Does anyone have a solution for this?
Here’s the last approach I tried:

$assistant_response = json_decode($response, true);
$reply_text = $assistant_response[‘response’][‘data’][0][‘content’][0][‘text’][‘value’] ?? “Error”;

I hope someone can help. Thank you in advance!