Welcome, guest | Sign In | My Account | Store | Cart

TextMagic is a provider of SMS services. Their SMS gateway is accessible via an HTTPS API. A convenient wrapper for this API is PyTextMagicSMS. Full documentation and source code is available on the project's website.

In order to use the service, you need to register at http://www.textmagic.com/ and obtain an API password (different from your login password) at https://www.textmagic.com/app/wt/account/api/cmd/password

Python, 31 lines
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import textmagic.client

# Use your username and API password to create a client
client = textmagic.client.TextMagicClient('your_username', 'your_api_password')

# Send a message and store its message id
result = client.send("Hello, World!", "1234567890")
message_id = result['message_id'].keys()[0]

# Now you can retrieve the delivery status using the message id
response = client.message_status(message_id)
status = response[message_id]['status']

# Replies to your outgoing messages are delivered to your TextMagic Inbox
# This is how you receive messages from your Inbox
received_messages = client.receive(0)
messages_info = received_messages['messages']
for message_info in messages_info:
  print "%(text)s received from %(from)s" % message_info

# Delete a message from your Inbox
client.delete_reply(message_info['message_id'])

# Get your account balance
balance = client.account()['balance']

# Find the country and cost of a telephone number
response = client.check_number('44123456789')
info = response['44123456789']
country = info['country']
credits = info['price']
Created by Dawie Strauss on Thu, 2 Jul 2009 (MIT)
Python recipes (4591)
Dawie Strauss's recipes (1)

Required Modules

Other Information and Tasks