Send status report

This commit is contained in:
Marko Jovanovic 2025-10-14 14:44:17 +02:00
parent 533c7f533e
commit d882308799

View File

@ -123,20 +123,22 @@ class ContactUncontactedCommand extends Command
}
}
try {
$responseStatus = $this->httpClient->request('POST', self::$apiEndpoint, [
'headers' => [
'X-CM-PRODUCTTOKEN' => $this->sms_gateway_api_key,
'Accept' => 'application/json',
'Content-Type' => 'application/json'
],
if ($this->status_number) {
$io->info('Sending status message...');
try {
$this->httpClient->request('POST', self::$apiEndpoint, [
'headers' => [
'X-CM-PRODUCTTOKEN' => $this->sms_gateway_api_key,
'Accept' => 'application/json',
'Content-Type' => 'application/json'
],
'body' => "{
'body' => "{
'messages': { 'msg': [{
'allowedChannels': ['SMS'],
'from': 'UKB',
'to': [
{ 'number': '004917672121270' }
{ 'number': '{$this->status_number}' }
],
'body': {
'type': 'auto',
@ -147,12 +149,12 @@ class ContactUncontactedCommand extends Command
'reference': 'UKB'
}] }}"
]);
} catch (Exception $e) {
$io->error(sprintf('An error occurred contacting the API for number %s: %s', '004917672121270', $e->getMessage()));
]);
} catch (Exception $e) {
$io->error(sprintf('An error occurred contacting the API for number %s: %s', $this->status_number, $e->getMessage()));
}
}
// Finalize all database changes
$this->entityManager->flush();
$io->progressFinish();