Skip to content

robertf224/Gwilio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gwilio

Host your own Twilio clone for free. All you need to do is create a Gwilio server using a gmail address, and then define behavior for how to respond to SMS messages to that gmail address (Gwilio uses the SMS to email gateways provided by ISPs).

Installation

pip install requests
pip install pygmail
pip install Gwilio

You should also create a new gmail address for your Gwilio server.

Usage

Gwilio can receive SMS messages and can either reply to them provided a callback function, or post the phone number and message to another server, mimicking the functionality provided by Twilio.

If you want to respond to messages directly, define a callback function which takes the phone number and the message as arguments. Whatever string you return will be the reply sent to the sender.

import Gwilio

def callback(number, message):
	if number == '9735550123' and message == 'password':
		return 'you may enter'

Gwilio.start('gmail-username', 'gmail-password', callback)

If you want to post the phone number and message to another server, just specify the post address. The server listening for requests at the specified post address should respond with the desired reply.

import Gwilio

Gwilio.start('gmail-username', 'gmail-password', post='http://example.com/post-endpoint')

In both of these examples, you would send SMS messages to [email protected] for your defined behavior to be carried out.

Future Updates

  • MMS support
  • Could add multithreading for replies

About

Host your own Twilio clone for free

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages