Пытаюсь отправить голосовое SMS с помощью arkesel, но каждый раз, запуская команду, я получаю эту ошибку
"Не удалось совершить вызов: ошибка Arkesel: требуется ключ "contents"
Я попробовал добавить этот `->asMultipart()`, потому что тестировал конечную точку с помощью почтальона, используя данные формы с 'voice_file' (который я загрузил почтальону) и 'recipients[]' (который был номер телефона), работает в почтальоне
public function makeCall($recipients)
{
$filePath = storage_path('app/public/assets/harvard.wav');
// Check if the file exists
if (!file_exists($filePath)) {
throw new Exception("Audio file not found at {$filePath}");
}
try {
$response = Http::withHeaders([
'api-key' => $this->apiKey
])
->attach('voice_file', fopen($filePath, 'r'), 'harvard.wav') // Attach the audio file
->post('https://sms.arkesel.com/api/v2/sms/voice/send', [
'recipients' => $recipients,
]);
// Check for successful response
if ($response->successful()) {
Log::info("Voice SMS sent successfully with Arkesel: ", ['recipients' => $recipients, 'response' => $response->json()]);
return $response->json();
} else {
Log::error("Voice SMS failed: ", ['recipients' => $recipients, 'error' => $response->body()]);
throw new Exception("Arkesel Error: " . $response->body());
}
} catch (Exception $e) {
Log::error("Voice SMS failed with exception: ", ['recipients' => $recipients, 'error' => $e->getMessage()]);
throw new Exception("Arkesel Error: " . $e->getMessage());
}
}```
Подробнее здесь: https://stackoverflow.com/questions/791 ... s-required