vonage-go-sdk icon indicating copy to clipboard operation
vonage-go-sdk copied to clipboard

Callback support/Delivery Receipt Processing

Open lshep311 opened this issue 5 years ago • 3 comments

The golang client we are currently using has implemented Delivery Receipts. In moving to this client implementation it appears that callbacks are on the TODO list. Is there a timeline for when this client will support processing delivery receipts? We have that on our roadmap. Additionally if this is already supported if there is an example then we can use that as well.

lshep311 avatar Jan 07 '20 01:01 lshep311

No timeline yet but I hear this request and will see what I can do!

lornajane avatar Feb 04 '20 18:02 lornajane

I'm not sure when we'll be adding webhook support into the library but in case you or anyone else finds it helpful, here's a minimal example that doesn't rely on the library.

package main

import (
	"log"
	"net/http"
)

func handleDlrWebhook(w http.ResponseWriter, r *http.Request) {
	log.Println("Delivery status for message to " + r.FormValue("msisdn") + ": " + r.FormValue("status"))
}

func main() {
	log.Println("server started")
	http.HandleFunc("/webhook/dlr", handleDlrWebhook)
	log.Fatal(http.ListenAndServe(":8080", nil))
}

This code starts a server on port 8080 - then you can use ngrok or a similar tool to make it available publicly (so that Nexmo's servers can send callbacks to it). If you then send an SMS with a parameter callback set to [your ngrok url]/webhook/dlr, this code will log the destination of the SMS message and its status.

Hope this helps to bridge the gap but rest assured that this issue will also stay open and we will work on this feature being in the library itself when we can.

lornajane avatar Mar 02 '20 12:03 lornajane

Update to say that with a new library release, we have the models in place to support this. Next is to work up a code sample showing the delivery receipts being received using this library and sharing it

lornajane avatar Sep 25 '20 10:09 lornajane