- Notifications
You must be signed in to change notification settings - Fork0
AI Powered Competitive Trivia
License
hummusonrails/trivia-game
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
SmartyCall is an interactive trivia game that uses Node.js, Couchbase, Twilio Voice and SMS APIs, and the OpenAI API to deliver trivia questions to players via phone calls and SMS. Players can register via SMS, receive trivia questions through phone calls, and get their scores tracked in real-time.
This application was built for theTwilio Hackathon Challenge on devto.
- User registration via SMS
- AI-generated trivia questions using OpenAI API
- Cached trivia questions in Couchbase
- Interactive voice-based gameplay with Twilio Voice
- Score tracking and leaderboard via Couchbase
- Delivery status tracking for SMS messages
- Node.js
- Express.js
- Couchbase
- Twilio Voice and SMS APIs
- OpenAI API
- Node.js and npm installed
- Couchbase Capella account
- Twilio account with a phone number
- OpenAI API key
Clone the repository:
git clone https://github.com/hummusonrails/trivia-game.gitcd trivia-game
Install dependencies:
npm install
Set up environment variables:
Create a
.env
file in the root directory with the following content:COUCHBASE_URL=couchbases://cb.<your-endpoint>.cloud.couchbase.comCOUCHBASE_USER=your-couchbase-usernameCOUCHBASE_PASSWORD=your-couchbase-passwordCOUCHBASE_BUCKET=your-couchbase-bucket-nameCOUCHBASE_BUCKET_QUESTIONS=your-couchbase-bucket-questions-nameTWILIO_ACCOUNT_SID=your-twilio-account-sidTWILIO_AUTH_TOKEN=your-twilio-auth-tokenTWILIO_PHONE_NUMBER=your-twilio-phone-numberOPENAI_API_KEY=your-openai-api-keySESSION_SECRET=your-session-secret
Run the application:
npm run start
Expose your local server to the internet:Usengrok to expose your local server to the internet for Twilio webhooks.
ngrok http 3000
- Send an SMS:Text "JOIN" to your Twilio phone number to register for the game.
- Receive a welcome message:You will receive a welcome message and instructions on how to start the game.
- Text "JOIN" to your Twilio phone number:You will receive a message with the phone number to call to start the game.
- Call the provided number:You will receive a welcome message followed by a trivia question. Each unique question is cached in Couchbase to avoid repeating the same question.
- Answer the trivia question:Respond via voice, and you will receive feedback on whether your answer was correct. Your score will be tracked.
- Text "LEADERBOARD" to your Twilio phone number:You will receive a message with your current score and rank on the leaderboard.
To get detailed delivery status for your messages, set the "Status Callback URL" in your Twilio settings to:
http://<your-ngrok-url>/callback/status
ai-trivia-game/├── src/│ ├── controllers/│ │ ├── voiceController.js│ │ ├── smsController.js│ │ ├── callbackController.js│ ├── services/│ │ ├── openaiService.js│ │ ├── twilioService.js│ │ ├── couchbaseService.js│ ├── routes/│ │ ├── voiceRoutes.js│ │ ├── smsRoutes.js│ │ ├── callbackRoutes.js│ ├── config/│ │ ├── couchbaseConfig.js│ │ ├── twilioConfig.js│ │ ├── openaiConfig.js│ ├── app.js│ └── server.js├── .env├── package.json├── package-lock.json└── README.md
- Fork the repository
- Create a new branch (
git checkout -b feature/your-feature-name
) - Commit your changes (
git commit -m 'Add some feature'
) - Push to the branch (
git push origin feature/your-feature-name
) - Create a new Pull Request
This project is licensed under the MIT License - see theLICENSE file for details.
Please read theCODE_OF_CONDUCT for details on the standards for collaboration within this project.
About
AI Powered Competitive Trivia
Resources
License
Code of conduct
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.