To modify the given code to get Fireflies transcripts participants and their IDs, you need to change the integration from GitHub to Fireflies and update the API request accordingly. Below is the modified code: import { axios } from "@pipedream/platform"; export default defineComponent({ name: "Source Demo", description: "This is a demo source", props: { fireflies: { type: "app", app: "fireflies", }, timer: { type: "$.interface.timer", default: { intervalSeconds: 15 ** 60, }, }, }, dedupe: "greatest", async run({ steps, $ }) { const data = { query: ` { transcripts { participants { id name email } } } `, }; const response = await axios($, { method: "POST", url: `https://api.fireflies.ai/graphql`, headers: { Authorization: `Bearer ${this.fireflies.$auth.api_key}`, }, data, }); const transcripts = response.data.data.transcripts; transcripts.forEach((transcript) => { transcript.participants.forEach((participant) => { this.$emit(participant, { id: participant.id, summary: `Participant: ${participant.name}`, ts: new Date().getTime(), }); }); }); }, }); ### Explanation: 1. Props Update: Changed the github prop to fireflies to connect the Fireflies app. 2. API Request: Updated the API request to Fireflies’ GraphQL endpoint to fetch transcripts and their participants. 3. *Data Handling: Iterated over the transcripts and their participants to emit each participant’s information. This code will fetch the participants of the transcripts from Fireflies and emit their details, including their IDs.
To modify the provided code to get all fields of transcripts, you need to update the GraphQL query to include all the fields you want to retrieve. Below is the modified code that includes additional fields for the transcripts: import { axios } from "@pipedream/platform"; export default defineComponent({ name: "Source Demo", description: "This is a demo source", props: { fireflies: { type: "app", app: "fireflies", }, timer: { type: "$.interface.timer", default: { intervalSeconds: 15 ** 60, }, }, }, dedupe: "greatest", async run({ steps, $ }) { const data = { query: ` { transcripts { id title created_at participants { id name email } content duration status } } `, }; const response = await axios($, { method: "POST", url: `https://api.fireflies.ai/graphql`, headers: { Authorization: `Bearer ${this.fireflies.$auth.api_key}`, }, data, }); const transcripts = response.data.data.transcripts; transcripts.forEach((transcript) => { this.$emit(transcript, { id: transcript.id, summary: `Transcript: ${transcript.title}`, ts: new Date(transcript.created_at).getTime(), }); }); }, }); ### Explanation: 1. GraphQL Query Update: The query now includes additional fields such as id, title, created_at, content, duration, and status for each transcript. 2. *Emit Transcript Data: The code now emits the entire transcript object instead of just the participants. This will allow you to get all the fields of the transcripts as specified in the updated query. If you need more fields, you can add them to the GraphQL query accordingly.
Your code is mostly correct, but there are a few minor issues that need to be addressed. Here’s the corrected version: 1. Remove the angle brackets around the URL in the axios request. 2. Ensure that the response object is correctly accessed to retrieve the data. Here is the corrected code: ```
import { axios } from “@pipedream/platform”; export default defineComponent({ name: “Source Demo”, description: “This is a demo source”, props: { fireflies: { type: “app”, app: “fireflies”, }, timer: { type: “$.interface.timer”, default: { intervalSeconds: 15 * 60, }, }, }, dedupe: “greatest”, async run({ steps, $ }) { const data = { query: { transcripts { id title created_at participants { id name email } content duration status } } , }; const response = await axios($, { method: “POST”, url: “Apollo Server”, headers: { Authorization: Bearer ${this.fireflies.$auth.api_key}, }, data, }); const transcripts = response.data.data.transcripts; transcripts.forEach((transcript) => { this.$emit(transcript); }); }, });