electrokean / messages-python-sdk

MessageMedia Python SDK for sending and receiving messages

Home Page:https://developers.messagemedia.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MessageMedia Messages Python SDK

Travis Build Status PyPI

The MessageMedia Messages API provides a number of endpoints for building powerful two-way messaging applications.

⭐️ Install via PIP

Run the following command to install the SDK via pip: pip install messagemedia-messages-sdk

🎬 Get Started

It's easy to get started. Simply enter the API Key and secret you obtained from the MessageMedia Developers Portal into the code snippet below and a mobile number you wish to send to.

🚀 Send an SMS

  • Destination numbers (destination_number) should be in the E.164 format. For example, +61491570156.
# Configuration parameters and credentials
from message_media_messages.message_media_messages_client import MessageMediaMessagesClient
import json

auth_user_name = 'YOUR_API_KEY' # The username to use with basic authentication
auth_password = 'YOUR_API_SECRET' # The password to use with basic authentication

client = MessageMediaMessagesClient(auth_user_name, auth_password)

messages_client = client.messages

body_value = '''{
    "messages":[
        {
            "content":"My first message",
            "destination_number":"YOUR_MOBILE_NUMBER"
        }
    ]
}'''

body = json.loads(body_value)

result = messages_client.create_send_messages(body)

🕓 Get Status of a Message

You can get a messsage ID from a sent message by looking at the message_id from the response of the above example.

# Configuration parameters and credentials
from message_media_messages.message_media_messages_client import MessageMediaMessagesClient
import json

auth_user_name = 'YOUR_API_KEY' # The username to use with basic authentication
auth_password = 'YOUR_API_SECRET' # The password to use with basic authentication

client = MessageMediaMessagesClient(auth_user_name, auth_password)

messages_client = client.messages

message_id = 'YOUR_MESSAGE_ID'

result = messages_client.get_message_status(message_id)
print result

💬 Get replies to a message

You can check for replies that are sent to your messages

# Configuration parameters and credentials
from message_media_messages.message_media_messages_client import MessageMediaMessagesClient
import sys
import json

auth_user_name = 'YOUR_API_KEY' # The username to use with basic authentication
auth_password = 'YOUR_API_SECRET' # The password to use with basic authentication

client = MessageMediaMessagesClient(auth_user_name, auth_password)

replies_client = client.replies

result = replies_client.get_check_replies()

✅ Check Delivery Reports

This endpoint allows you to check for delivery reports to inbound and outbound messages.

# Configuration parameters and credentials
from message_media_messages.message_media_messages_client import MessageMediaMessagesClient
import sys
import json

auth_user_name = 'YOUR_API_KEY' # The username to use with basic authentication
auth_password = 'YOUR_API_SECRET' # The password to use with basic authentication

client = MessageMediaMessagesClient(auth_user_name, auth_password)

delivery_reports_client = client.delivery_reports

result = delivery_reports_client.get_check_delivery_reports()

📕 Documentation

The Python SDK Documentation can be viewed here

😕 Got Stuck?

Please contact developer support at developers@messagemedia.com or check out the developer portal at developers.messagemedia.com

About

MessageMedia Python SDK for sending and receiving messages

https://developers.messagemedia.com/

License:Apache License 2.0


Languages

Language:Python 100.0%