Skip to main content

Command Palette

Search for a command to run...

Text alerts are here!

Updated
Text alerts are here!

Tube Feed Tracker Message Board Alerts, that is.

In order to receive feedback from Tube Feed Tracker users, I’ve shared my contact information in the about section - but I had no way to reach them with updates. Solution: I put together a message board within the web app with the assistance of Breeze, one of Laravel’s start kits.

It uses Laravel and PHP on the backend, with Eloquent ORM for database management, and Blade templates and Tailwind CSS on the front end.

For local development on Herd I’m using SQLite for simplicity’s sake, but once deployed to Laravel Cloud it uses PostgresSQL.

At the moment I am the only administrator (because I disabled public registration). There’s full CRUD message management, I am able to schedule a message, and it all looks nice and simple thanks to Tailwind.

The messages are also color coded by category, depending on whether it’s an updated feature, a tip, general update, or something about maintenance.

Side note! I am not familiar with Alpine.js but got to know it a little better thanks to Laravel Breeze. It’s an easy enough JavaScript framework that handles the small interactions like the dropdown and mobile hamburger menus. I didn’t need to bust out any React at all!

Anyone dedicated to using the Tube Feed Tracker daily would benefit from these announcements - maybe I need to explain a new feature, provide video guidance, etc…so what if I was able to text subscribers whenever an update was posted? Enter Twilio.

I’m getting ahead of myself a bit because technically I am still waiting for my Twilio phone number to be approved for registration, but I set up debug logging that allowed me to see that the messages may in fact be working.

Make a Twilio account and get your SID, Auth Token, and phone number. Those go into a .env file as well as your custom environmental variable if you are hosting elsewhere, like Laravel Cloud.

I then installed Twilio’s PHP SDK and added Twilio’s Rest\Client import statement to my Message Controller. I added the sendSMS() function, which is private because it’s only used internally and no other parts of the app need to call it directly. And in order to create the message content, I also added
$this->sendSMS($message->title, $message->message);
to the store function.

The Subscriber Controller and Subscriber table were made with Laravel’s Artisan commands. It is where user’s numbers would be stored once they input their data and opt into subscribing to the alerts. It’s also how I input my own information (after a failed seeder attempt) so I could test run the system. The subscriber form was just a simple Blade template.

Importing the Log Facade allowed me to debug log, which is how I was able to see that the messages were sending properly, even though I wasn’t receiving anything. Let’s troubleshoot that.

I hit up the Twilio dashboard to see that it failed because my brand new number is not registered yet - whoops! I have to wait about a week or so for A2P campaign to be approved for registration. But! Based on the logs, supposedly it will all work out nicely. I’ll check back to let you know!

More from this blog