Notifications

A Notification resource represents a single log entry made by Twilio in the course of handling your calls or your use of the REST API. For more information, see the Notifications REST Resource documentation.

Listing Your Notifications

The following code will print out additional information about each of your current Notification resources.

from twilio.rest import TwilioRestClient

# To find these visit https://www.twilio.com/user/account
ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXX"
AUTH_TOKEN = "YYYYYYYYYYYYYYYYYY"

client = TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN)
for notification in client.notifications.list():
    print notification.more_info

You can filter transcriptions by log and message_date. The log value is 0 for ERROR and 1 for WARNING.

from twilio.rest import TwilioRestClient

# To find these visit https://www.twilio.com/user/account
ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXX"
AUTH_TOKEN = "YYYYYYYYYYYYYYYYYY"

client = TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN)

ERROR = 0

for notification in client.notifications.list(log=ERROR):
    print notification.error_code

Note

Due to the potentially voluminous amount of data in a notification, the full HTTP request and response data is only returned in the Notification instance resource representation.

Deleting Notifications

Your account can sometimes generate an inordinate amount of Notification resources. The Notifications resource allows you to delete unnecessary notifications.

from twilio.rest import TwilioRestClient

# To find these visit https://www.twilio.com/user/account
ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXX"
AUTH_TOKEN = "YYYYYYYYYYYYYYYYYY"

client = TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN)
client.notifications.delete("NO123")