Event-on-air is a social media wall that is primarily meant to encourage/show social media engagement during events, especially used to hype the crowd when waiting for events/talks to start. Although there are providers who already does this, they usually costly and you cannot control the update frequency if you're on the free plan.
A demo is available here
Automatically pull twitter/instagram feeds with your event hashtag
- ✅ New feeds will always appear in front of the list
- ✅ Moderate posts automatically/manually on monderator screen before showing
- ✅ Ability to adjust number of lanes on the fly, depending on screen resolution.
- ✅ Adjust header and subtitle in real time.
- ✅ Ability to configure hashtag on the fly
- ✅ Ability to configure how fast/slow new posts appear on screen
- ✅ Ability to configure how many posts can be queued before showing.
- A Firebase project. Sign into Firebase using your Google account, and create a new project in the Firebase console here
- Have completed the setup for backend. If you have not done so, please follow the Serverless on Firebase Cloud Functions here
- Clone this project
- Install dependencies via npm or yarn
- Go to the
src/environments/environment.ts
and update your firebase configuration and Facebook App Id. Be sure to update theenvironment.prod.ts
as well
export const environment = {
production: false,
firebase: {
apiKey: "api-key",
authDomain: "project-id.firebaseapp.com",
databaseURL: "https://project-id.firebaseio.com",
projectId: "project-id",
storageBucket: "project-id.appspot.com",
messagingSenderId: "sender-id",
},
facebookAppId: "facebookAppId"
};
- Start the project locally via
npm run start
- Navigate to http://localhost:4200/moderate
- Login with your Google Account as specified in the email you have entered in Firestore
admin
collection. - If you have setup your admin user correctly in this guide, you should see the following screen:
- If you have facebook logged in, please log out and log in again.
- Check Firestore to ensure the
userAccessToken
is automatically filled in like the screen below:
- Set Firebase project
firebase use project-id
- Build for production
npm run build
- Deploy to Firebase Hosting
firebase deploy
We will need to trigger a call to get twitter posts.
-
Go to https://console.cloud.google.com/cloudpubsub/topicList?project=PROJECT_ID. Make sure to change PROJECT_ID with your Firebase project. If you have setup your backend correctly you should see the 2 topics appearing in page.
-
Click on
pull-twitter-api
topic. Click publish message. Enter any description you like and click publish. -
If it is succesful you should see a collection called
tweets
orposts
in Firestore. Refresh the page a few times after triggering a call, or visit your Firebase deployed webpage to see -
Repeat step 2 with
pull-instagram-api
you should see them appearing too.
Now that we know the code is working well, we now need to setup cron job on Cloud Scheduler to fetch data every x minutes
- Go to Cloud Scheduler https://console.cloud.google.com/cloudscheduler
- Create a job with details like the picture below: !cron](https://res.cloudinary.com/shangyilim/image/upload/v1555254378/cron.png)
- The cron expression
*/2 * * * *
runs every 2 minutes. Change according to how frequent you want your cloud functions to pul data from twitter/instagram. - REMEMBER to delete the job after the event or when you no longer want to run it! Otherwise the job keep running and may incur unecessary costs.
Here's a few things that may help you fix issues you might face
- Make sure Firebase Blaze plan is turned on.
- Make sure the Twitter API key and its secret is saved in the
functions/config
of this repo - Make sure the fbConfig values are all present as shown in step 9.
- Make sure the
searchConfig
hastag really has public post with the hashtag you specified. - Check the Cloud Functions Logs to see if there are any hints there.
- If all else fails feel free to create an issue