curl --request POST \
--url https://api.example.com/api/conversations/{id}/reply \
--header 'Content-Type: application/json' \
--data '
{
"message": "<string>"
}
'{
"success": true,
"message": "<string>",
"error": "<string>"
}Send a human reply to a conversation via WhatsApp
curl --request POST \
--url https://api.example.com/api/conversations/{id}/reply \
--header 'Content-Type: application/json' \
--data '
{
"message": "<string>"
}
'{
"success": true,
"message": "<string>",
"error": "<string>"
}POST /api/conversations/{id}/reply
active.
success is true)success is false)curl -X POST 'https://your-domain.com/api/conversations/1/reply' \
-H 'Content-Type: application/json' \
-d '{
"message": "Thank you for contacting us. Your issue has been resolved."
}'
{
"success": true,
"message": "Reply sent successfully"
}
{
"success": false,
"error": "Error al enviar respuesta"
}
{
"success": false,
"error": "Error al enviar respuesta"
}
api/reply-conversation.php and performs the following operations:
sender_type = humanactivelast_message_at timestampindex.php:172):
if ($requestMethod === 'POST' &&
preg_match('#^/api/conversations/(\d+)/reply$#', $path, $matches)) {
$_GET['id'] = $matches[1];
require __DIR__ . '/api/reply-conversation.php';
}
reply-conversation.php:15-21):
$id = $_GET['id'] ?? null;
$input = json_decode(file_get_contents('php://input'), true);
$message = $input['message'] ?? null;
if (!$id || !$message) {
throw new \InvalidArgumentException('Conversation ID and message required');
}
reply-conversation.php:54):
$whatsapp->sendMessage($result['phone_number'], $message);
reply-conversation.php:56-63):
$conversationService->addMessage($id, 'human', $message);
$conversationService->updateConversationStatus($id, 'active');
$db->query(
'UPDATE conversations SET last_message_at = NOW() WHERE id = :id',
[':id' => $id]
);
CredentialService)config/config.php)active after a human replylast_message_at timestamp is updated to the current time