Skip to main content
Question

Webhook Response

  • January 21, 2022
  • 1 reply
  • 297 views

Im using the webhook to get the SMS message when they arrive with event filter

/restapi/v1.0/account/{accountId}/extension/{extensionId}/message-store/instant?type=SMS

my problem is reading the binary stream. Im hoping .. fingers crossed that someone can help with classic ASP code.. I know its not modern, but its what Im using. so I found this page online https://stackoverflow.com/questions/56304711/how-to-receive-a-webhook-in-asp-classic

but I get error 3001 on the line Stream.Write bytes

Dim lngBytesCount, post
lngBytesCount = Request.TotalBytes
post = BytesToStr(Request.BinaryRead(lngBytesCount))
Response.ContentType = "text/plain"

Function BytesToStr(bytes)
    Dim Stream
    Set Stream = Server.CreateObject("Adodb.Stream")
        Stream.Type = 1 'adTypeBinary
        Stream.Open
        Stream.Write bytes
        Stream.Position = 0
        Stream.Type = 2 'adTypeText
        Stream.Charset = "utf-8"
        BytesToStr = Stream.ReadText
        Stream.Close
    Set Stream = Nothing
End Function

thanks for any and all help


1 reply

PhongVu
Community Manager
Forum|alt.badge.img
  • Community Manager
  • 2473 replies
  • January 24, 2022

I don't think you would get much help from this community with this question which is much related to VBA. Recommend you post your question in stack overflow.