wallet.andert.me/.wundergraph/operations/getChatwootContacts.ts

20 lines
556 B
TypeScript
Raw Permalink Normal View History

2023-09-21 18:45:49 +00:00
// .wundergraph/operations/getChatwootContacts.ts
import { createOperation, z } from '../generated/wundergraph.factory';
import axios from 'axios';
export default createOperation.query({
input: z.object({
2023-09-21 20:03:40 +00:00
2023-09-21 18:45:49 +00:00
}),
2023-09-21 20:03:40 +00:00
handler: async () => {
2023-09-21 18:45:49 +00:00
console.log('Making request to Chatwoot API');
2023-09-21 20:03:40 +00:00
const { data } = await axios.get(`https://chatwoot.andert.me/api/v1/accounts/1/contacts`, {
2023-09-21 18:45:49 +00:00
headers: {
api_access_token: process.env.CHATWOOT_API_ACCESS_TOKEN
},
});
return data;
},
});