How to Modify the Provided Code to Extract Fireflies Transcripts Participants and Their IDs?

This topic was automatically generated from Slack. You can find the original thread here.

the following code, modify it to get fireflies transcripts participants and their id, all information:

import { axios } from “@pipedream/platform”;

export default {
name: “Source Demo”,
description: “This is a demo source”,
props: {
github: {
type: “app”,
app: “github”,
},
timer: {
type: “$.interface.timer”,
default: {
intervalSeconds: 15 * 60,
},
},
},
dedupe: “greatest”,
async run() {
const data = await axios(this, {
method: “get”,
headers: {
Authorization: Bearer ${this.github.$auth.oauth_access_token},
},
url: https://api.github.com/repos/pddemo/demo/issues,
});
data.forEach((issue) => {
this.$emit(issue, {
id: issue.id,
summary: ISSUE ${issue.number}: ${issue.title},
ts: issue.created_at && +new Date(issue.created_at),
});
});
},
};

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.

the folloiwng, modify it to get all fields of 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 { 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(),
    });
  });
});

},
});

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.

i want all thius data :

query Transcripts(
$title: String
$date: DateTime
$limit: Int
$skip: Int
$hostEmail: String
$participantEmail: String
$userId: String
) {
transcripts(
title: $title
date: $date
limit: $limit
skip: $skip
host_email: $hostEmail
participant_email: $participantEmail
user_id: $userId
) {
id
sentences {
index
speaker_name
speaker_id
text
raw_text
start_time
end_time
ai_filters {
task
pricing
metric
question
date_and_time
text_cleanup
sentiment
}
}
title
host_email
organizer_email
calendar_id
user {
user_id
email
name
num_transcripts
recent_meeting
minutes_consumed
is_admin
integrations
}
fireflies_users
participants
date
transcript_url
audio_url
video_url
duration
meeting_attendees {
displayName
email
phoneNumber
name
location
}
summary {
action_items
keywords
outline
overview
shorthand_bullet
}
}
}

To help you retrieve the data you need, it looks like you want to query a GraphQL API for transcripts. Here’s a Pipedream component that will allow you to make a GraphQL request with the specified query and variables. First, ensure you have the necessary GraphQL endpoint and authorization details. Then, you can use the following Pipedream component: ``` import { axios } from “@pipedream/platform”; export default defineComponent({ props: { graphqlEndpoint: { type: “string”, label: “GraphQL Endpoint”, }, apiKey: { type: “string”, label: “API Key”, }, title: { type: “string”, label: “Title”, optional: true, }, date: { type: “string”, label: “Date”, optional: true, }, limit: { type: “integer”, label: “Limit”, optional: true, }, skip: { type: “integer”, label: “Skip”, optional: true, }, hostEmail: { type: “string”, label: “Host Email”, optional: true, }, participantEmail: { type: “string”, label: “Participant Email”, optional: true, }, userId: { type: “string”, label: “User ID”, optional: true, }, }, async run({ steps, $ }) { const query = ` query Transcripts( $title: String $date: DateTime $limit: Int $skip: Int $hostEmail: String $participantEmail: String $userId: String ) { transcripts( title: $title date: $date limit: $limit skip: $skip host_email: $hostEmail participant_email: $participantEmail user_id: $userId ) { id sentences { index speaker_name speaker_id text raw_text start_time end_time ai_filters { task pricing metric question date_and_time text_cleanup sentiment } } title host_email

is the folloiwng correct from fireflies api pov ?

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);
});

},
});

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); }); }, });