toqueteo un poco en cómo hago el fetchAllGroups a ver si consigo que me mande la respuesta que sí me funciona con curl pero no haciendo un fetch

main
borja 3 months ago
parent 3bf5e33763
commit 244a6e9483

@ -79,13 +79,14 @@ export class GroupSyncService {
private static async fetchGroupsFromAPI(): Promise<EvolutionGroup[]> { private static async fetchGroupsFromAPI(): Promise<EvolutionGroup[]> {
const url = `${env.EVOLUTION_API_URL}/group/fetchAllGroups/${env.EVOLUTION_API_INSTANCE}?getParticipants=false`; const url = `${env.EVOLUTION_API_URL}/group/fetchAllGroups/${env.EVOLUTION_API_INSTANCE}?getParticipants=false`;
console.log(' Fetching groups from API:', { console.log(' Fetching groups from API:', {
url: `${url.substring(0, 50)}...`, // Log partial URL for security url: `${url}...`, // Log partial URL for security
communityId: env.WHATSAPP_COMMUNITY_ID, communityId: env.WHATSAPP_COMMUNITY_ID,
time: new Date().toISOString() time: new Date().toISOString()
}); });
try { try {
const response = await fetch(url, { const response = await fetch(url, {
method: 'GET',
headers: { headers: {
apikey: env.EVOLUTION_API_KEY, apikey: env.EVOLUTION_API_KEY,
}, },
@ -105,6 +106,7 @@ export class GroupSyncService {
} }
const data = await response.json(); const data = await response.json();
console.log(data);
console.log(' API response:', { console.log(' API response:', {
status: data.status, status: data.status,
message: data.message, message: data.message,

Loading…
Cancel
Save