Here's a quick and dirty way to manage SMS groups using PHP and Twilio. This is handy for events like summer camps or other events when you want to get a message out to organizers / counselors quickly.
This code is a few years old, but it has been updated to use the latest Twilio PHP library.
- Onboarding flow for new members
- Users join by texting anything to the number, then following the directions.
- Members can leave the group by sending:
-stop
. - Members can change their nicknames by sending:
-name
(new nickname). - The group administrator get alerted when members join.
- All messages are logged in the database.
- Messages can contain up to 1600 characters.
- Twilio PHP library
- A Twilio account with credits and a caller ID verified phone number.
- PHP
- MySQL database
- A tolerance for procedural PHP
- Get your account set up at Twilio and verify your number.
- Point your SMS settings to the location of sms.php on your server.
- Execute database_setup.sql to set up the required tables.
- Fill in the necessary variables in
settings.php
. - Drop the Twilio PHP Library in the directory root and make sure the path at the top of
sms.php
is correct. - Send a text to your number and follow the directions to join the group.
- This needs a better way for an admin to manage the users. Right now, you need to manage users directly in the database.
Yeah, it uses the depracated(Updated to mysqli on 7-15-2014)mysql_connect()
. It should be updated tomysqli_connect()
or pdo.