Sample code for 30+ languages & platforms
Classic ASP Requires Chilkat v11.0.0+

Check message delivery status with Twilio

See more Twilio Examples

Fetch an outbound SMS or MMS using the Message SID returned by a live send. A queued message is waiting to be sent. A sent message has been accepted by the upstream carrier. Delivered means Twilio received delivery confirmation. Some routes provide no final delivery receipt.

Read the current status once per lookup. For failed or undelivered messages, display the available delivery error code and text for troubleshooting. A missing message or an HTTP authentication error is a separate result from a delivery failure.

Twilio documentation

Chilkat Classic ASP Downloads

Classic ASP
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0

'  Assumes Chilkat is unlocked. See Global Unlock Sample.
'  Load an API key for the Twilio account from private application configuration.
set http = Server.CreateObject("Chilkat.Http")
http.RequireSslCertVerify = 1
http.BasicAuth = 1
http.Login = "YOUR_API_KEY_SID"
http.Password = "YOUR_API_KEY_SECRET"

set url = Server.CreateObject("Chilkat.StringBuilder")
success = url.Append("https://api.twilio.com/2010-04-01/Accounts/")
success = url.Append("YOUR_ACCOUNT_SID")
success = url.Append("/Messages")
success = url.Append("/")
success = url.Append("YOUR_MESSAGE_SID")
success = url.Append(".json")
set resp = Server.CreateObject("Chilkat.HttpResponse")
set reply = Server.CreateObject("Chilkat.JsonObject")

success = http.HttpNoBody("GET",url.GetAsString(),resp)
If (resp.StatusCode = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( "No HTTP response from Twilio.") & "</pre>"
    Response.End
End If

parsed = reply.Load(resp.BodyStr)
If ((success <> 1) Or (resp.StatusCode <> 200)) Then
    Response.Write "<pre>" & Server.HTMLEncode( "Twilio returned HTTP " & resp.StatusCode) & "</pre>"
    If ((parsed = 1) And (reply.JsonTypeOf("code") = 2)) Then
        Response.Write "<pre>" & Server.HTMLEncode( "Twilio error: " & reply.IntOf("code") & "  " & reply.StringOf("message")) & "</pre>"
    End If

    Response.End
End If

If (parsed <> 1) Then
    Response.Write "<pre>" & Server.HTMLEncode( "Expected a JSON response from Twilio.") & "</pre>"
    Response.End
End If

If (reply.JsonTypeOf("status") <> 1) Then
    Response.Write "<pre>" & Server.HTMLEncode( "Message status missing from response.") & "</pre>"
    Response.End
End If

Response.Write "<pre>" & Server.HTMLEncode( "Delivery status: " & reply.StringOf("status")) & "</pre>"
If ((reply.StringOfEquals("status","failed",1) = 1) Or (reply.StringOfEquals("status","undelivered",1) = 1)) Then
    If (reply.JsonTypeOf("error_code") = 2) Then
        Response.Write "<pre>" & Server.HTMLEncode( "Delivery error code: " & reply.IntOf("error_code")) & "</pre>"
    End If

    If (reply.JsonTypeOf("error_message") = 1) Then
        Response.Write "<pre>" & Server.HTMLEncode( reply.StringOf("error_message")) & "</pre>"
    End If

End If


%>
</body>
</html>