Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
An example on connecting to the Fireflies API with Python 3
# An example to get some data using the Fireflies GraphQL API
import requests
headers = {"Authorization": "Bearer YOUR-TOKEN-GOES-HERE"}
def run_query(query): # A simple function to use requests.post to make the API call. Note the json= section.
request = requests.post('https://api.fireflies.ai/graphql', json={'query': query}, headers=headers)
if request.status_code == 200:
return request.json()
else:
raise Exception("Query failed to run by returning code of {}. {}".format(request.status_code, query))
# The GraphQL query (with a few aditional bits included) itself defined as a multi-line string.
query = """
{
user {
email
recent_transcript
}
}
"""
result = run_query(query) # Execute the query
recent_transcript = result["data"]["user"]["recent_transcript"] # Drill down the dictionary
print("Most recent transcript from user - {}".format(recent_transcript))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment