---
# System prepended metadata

title: SpkNetwork - Using GraphQL for 3Speak Mobile App
tags: [threespeak, updates, development, mobile, iOS, app, Android, hive, graphql, spknetwork, sagarkothari88]

---

![threespeakupdates.png](https://files.peakd.com/file/peakd-hive/threespeak/23tS147xohPtdoFDTiU4SZJSNJ6icsbYKnx1ugcZGLpoXvPTMMeS4Ljzaqen9Y8aErFh5.png)

@eddiespino - video to attach

https://www.dropbox.com/scl/fi/twinfoefm78fpqxis4hcw/3Speak-GraphQL.mp4?rlkey=h2aggn2ejx9uw5e8y7povjp9p&dl=0

@eddiespino - we need to change the above image to which says something like SpkNetwork's GraphQL + Union Indexer + 3Speak Mobile App

<div class="text-justify">

**Greetings 3Speak Community Members,**

With this 3Speak Video & Hive-post, @sagarkothari88 illustrates how to use GraphQL Queries based on Union Indexer.

## SPK Network is always Open-source:

- Mobile app source code
    - https://github.com/spknetwork/Android-app
- Legacy / Current website
    - https://github.com/spknetwork/3speak-legacy-frontend
- Legacy / Current creator studio
    - https://github.com/spknetwork/3speak-legacy-studio
- Union Indexer
    - https://github.com/spknetwork/union-indexer-node

    
## What is GraphQL?

- GraphQL is a query language for APIs and a runtime for fulfilling those queries with existing data
- GraphQL provides interactive way of building the queries & play around it.
- You can select the attributes / fields / properties of your choice for the response.

## Why GraphQL now on Mobile App?

- Mobile app is showing different feeds but it's not sorted as per the curation amount.
- For each individual video, payout info, votes etc values are fetched, over & over, when it gets displayed on the screen.
- This consumes internet bandwidth & you may want to avoid if you are on mobile-data.
- There are other issues with existing feed.
- Feed needs to be updated.
- With GraphQL, we can fix these issues & have needed data in single request.
- @sagarkothari88 is now implementing GraphQL based feeds on 3Speak-Mobile-application.

## How to use GraphQL?

- Please view the video to understand in details with live demo.
- Open this link - https://union.us-02.infra.3speak.tv/api/v2/graphql
- Select feed of your choice.
    - Social Feed
    - Trending Feed

![Screenshot 2023-07-27 at 12.29.43 AM.png](https://files.peakd.com/file/peakd-hive/sagarkothari88/23tGY56Yrw9BqyesS6pLzYK9HDFTAwLecBDuVTZuWiFHbmNohiK3SXnC1SYJPhJLPyDFM.png)
    
- Select attributes which you need for your User Interface

![Screenshot 2023-07-27 at 12.31.17 AM.png](https://files.peakd.com/file/peakd-hive/sagarkothari88/23tGXT4ouZx923ADDWxohpakQ1dRadRhrXr4o9QL9ejjsZrX3fmEHiNiNxHynw82LW6MJ.png)
    
- Do not forget to apply this filter if you wish to only get the data for Videos.

![Screenshot 2023-07-27 at 12.34.46 AM.png](https://files.peakd.com/file/peakd-hive/sagarkothari88/23tGY58JvQK8Y2o5g98YvFrpx5B8hetSkCUoPGpj4sv4WyaEycci5v6Po66kueJTWzvKb.png)
    
- Hit run button.

![Screenshot 2023-07-27 at 12.41.13 AM.png](https://files.peakd.com/file/peakd-hive/sagarkothari88/Eo45HnycXiJo1qy4tbQXvhK1LoJGKtkgKT3VKfdNoTTE7PvG56u1KpNeNsRkRxPq7Rj.png)


## Ready-made GraphQL Queries for you

### Trending Feed

```
query MyQuery {
  trendingFeed(spkvideo: {only: true}) {
      items {
        ... on HivePost {
          spkvideo
          stats {
            num_comments
            num_votes
            total_hive_reward
          }
          lang
          title
          tags
          permlink
          created_at
          body
        }
    }
  }
}
```

### New Videos Feed

```
query MyQuery {
  socialFeed(spkvideo: {only: true}) {
          items {
        ... on HivePost {
          spkvideo
          stats {
            num_comments
            num_votes
            total_hive_reward
          }
          lang
          title
          tags
          permlink
          created_at
          body
        }
  }
}
```

### First Uploads Feed

```
query MyQuery {
  socialFeed(spkvideo: {only: true, firstUpload: true}) {
    items {
        ... on HivePost {
          spkvideo
          stats {
            num_comments
            num_votes
            total_hive_reward
          }
          lang
          title
          tags
          permlink
          created_at
          body
    }
  }
}
```

### Related Videos

```
query MyQuery {
  relatedFeed(permlink: "sdltslwo", author: "leofinance") {
        items {
        ... on HivePost {
          spkvideo
          stats {
            num_comments
            num_votes
            total_hive_reward
          }
          lang
          title
          tags
          permlink
          created_at
          body
    	}
    }
  }
}
```

### My Published Videos

```
query MyQuery {
  socialFeed(
    spkvideo: {only: true}
    feedOptions: {byCreator: {_eq: "sagarkothari88"}}
  ) {
    items {
      ... on HivePost {
        body
        title
        tags
        stats {
          num_comments
          num_votes
          total_hive_reward
        }
        spkvideo
        permlink
        lang
        community
        created_at
      }
    }
  }
}
```

### 3Shorts
    
```
query MyQuery {
  socialFeed(
    spkvideo: {only: true, isShort: true}
  ) {
    items {
      ... on HivePost {
        body
        title
        tags
        stats {
          num_comments
          num_votes
          total_hive_reward
        }
        spkvideo
        permlink
        lang
        community
        created_at
      }
    }
  }
}
```

### Leaderboard

coming soon.

### Community Details

```
query MyQuery {
  community(id: "hive-181335") {
    title
    about
    created_at
    images {
      avatar
      cover
    }
    roles {
      role
      title
      username
    }
    subscribers
  }
}
```

### Videos from a community

```
query MyQuery {
  community(id: "hive-181335") {
    title
    about
    created_at
    images {
      avatar
      cover
    }
    roles {
      role
      title
      username
    }
    subscribers
    trendingFeed {
      items {
        ... on HivePost {
          spkvideo
          stats {
            num_comments
            num_votes
            total_hive_reward
          }
          lang
          title
          tags
          permlink
          created_at
          body
        }
      }
    }
  }
}
```

---
    
![color3speak.png](https://files.peakd.com/file/peakd-hive/threespeak/23tRvWvmwuE7SGkXfPhHY8GPxiwaVKnVtzAFwDjuXFM3gWtRS6dr2F4yK4vexmaUHERuK.png) 
    
### <center>Important Links:</center>

|||
|:-:|:-:|
|[3Speak Linktree](https://linktr.ee/3speak)|[SPK Network Linktree](https://linktr.ee/spknetwork)|

| | | | |
|-|-|-|-|
|[3Speak.tv](https://3speak.tv)| [3Speak Twitter](https://twitter.com/3speakonline) | [3Speak Hive Blog](https://hive.blog/@threespeak) | [3Speak Telegram](https://t.me/threespeak) |
| [3Speak in Spanish](https://peakd.com/@threespeak-es/posts) | [Download Android App](https://play.google.com/store/apps/details?id=tv.threespeak.app) | [Download iOS App](https://apps.apple.com/us/app/3speak/id1614771373) | [Download Desktop App](https://github.com/spknetwork/3Speak-app/releases)
| [Join 3Speak Discord](https://discord.gg/NSFS2VGj83) | [Setup Encoder Node](https://ecency.com/hive-181335/@sagarkothari88/retfajht) | [Vote for SPK Network Proposal](https://peakd.com/hive-112019/@spknetwork/spk-network-funding-proposal-rhnv7e) | [Badge Recipients](https://peakd.com/b/badge-181335/recipients) |

|||
|:-:|:-:|
[![appStore](https://i.imgur.com/enwTLng.png)](https://apps.apple.com/us/app/3speak/id1614771373) | [![GooglePlayStore](https://i.imgur.com/6K5fgGX.png)](https://play.google.com/store/apps/details?id=tv.threespeak.app)|
    
### <center>[Vote for 3Speak as Witness](https://vote.hive.uno/@threespeak) - [![Support @threespeak](https://i.imgur.com/2cEH8bp.png)](https://hivesigner.com/sign/account-witness-vote?witness=threespeak&approve=1)</center>
    
### <center>[Vote for Sagarkothari88 as Witness](https://vote.hive.uno/@sagarkothari88) - [![Support @sagarkothari88](https://i.imgur.com/bTdSCuq.png)](https://hivesigner.com/sign/account-witness-vote?witness=sagarkothari88&approve=1)</center>
   
</div>