Carga y configuración de platilla de api de whats app
This commit is contained in:
+2
-1
@@ -22,7 +22,8 @@ RUN npm ci && \
|
||||
npm run build
|
||||
|
||||
RUN mkdir -p storage/framework/sessions storage/framework/views storage/framework/cache storage/app/livewire-tmp storage/logs \
|
||||
&& chmod -R 775 storage bootstrap/cache
|
||||
&& chmod -R 775 storage bootstrap/cache \
|
||||
&& chown -R nobody:nginx storage bootstrap/cache
|
||||
|
||||
RUN php artisan storage:link
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ class WhatsAppService
|
||||
return $response->json('messages.0.id');
|
||||
}
|
||||
|
||||
public function enviarPromocion(string $telefono, Promocion $promocion): string
|
||||
/*public function enviarPromocion(string $telefono, Promocion $promocion): string
|
||||
{
|
||||
$payload = [
|
||||
'messaging_product' => 'whatsapp',
|
||||
@@ -91,6 +91,25 @@ class WhatsAppService
|
||||
throw new \RuntimeException($response->body());
|
||||
}
|
||||
|
||||
return $response->json('messages.0.id');
|
||||
}*/
|
||||
|
||||
public function enviarPromocion(string $telefono, Promocion $promocion): string
|
||||
{
|
||||
$response = Http::withToken($this->token)->post($this->apiUrl, [
|
||||
'messaging_product' => 'whatsapp',
|
||||
'to' => $this->normalizarTelefono($telefono),
|
||||
'type' => 'template',
|
||||
'template' => [
|
||||
'name' => 'hello_world',
|
||||
'language' => ['code' => 'en_US'],
|
||||
],
|
||||
]);
|
||||
|
||||
if ($response->failed()) {
|
||||
throw new \RuntimeException($response->body());
|
||||
}
|
||||
|
||||
return $response->json('messages.0.id');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user