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

Clickatell Chat Flow: Resume a waiting conversation

See more Clickatell Examples

Use this outbound REST call from a billing job after it generates an invoice. Configure a Wait for Callback node with the same reference UUID supplied to the job and the result value used by the flow. Reuse that UUID for retries. Clickatell hosts the endpoint. The billing job needs no inbound HTTP listener.

Clickatell API reference

Chilkat Classic ASP Downloads

Classic ASP
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
'  Assumes Chilkat is unlocked. See Global Unlock Sample.
set http = Server.CreateObject("Chilkat.Http")
http.RequireSslCertVerify = 1

'  These values come from the waiting session and its configured result branch.
http.SetRequestHeader "reference","WAITING_SESSION_UUID"
http.SetRequestHeader "result","invoice_ready"
set data = Server.CreateObject("Chilkat.JsonObject")
success = data.UpdateString("invoiceNumber","INV-1042")
set resp = Server.CreateObject("Chilkat.HttpResponse")
sent = http.HttpJson("POST","https://flow-callback.clickatell.com/chat/callback",data,"application/json",resp)
If (resp.StatusCode = 204) Then
    Response.Write "<pre>" & Server.HTMLEncode( "Clickatell already processed this reference.") & "</pre>"
    Response.End
End If

If ((sent = 1) And (resp.StatusCode = 202)) Then
    Response.Write "<pre>" & Server.HTMLEncode( "Invoice data accepted for the waiting conversation.") & "</pre>"
    Response.End
End If

If (resp.StatusCode = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( "No response. Keep the same reference if the job retries.") & "</pre>"
    Response.End
End If

Response.Write "<pre>" & Server.HTMLEncode( "Chat Flow returned HTTP " & resp.StatusCode) & "</pre>"
If ((resp.StatusCode = 400) Or (resp.StatusCode = 410)) Then
    Response.Write "<pre>" & Server.HTMLEncode( "Check the reference, result and whether the session is still waiting.") & "</pre>"
End If


%>
</body>
</html>