Vonage / vonage-go-sdk

A lightweight library to help Go users everywhere integrate with the Vonage APIs. Issues and PRs all really welcome!!
https://vonage.github.io/vonage-go-sdk/
Apache License 2.0
51 stars 32 forks source link

Callback support/Delivery Receipt Processing #23

Open lshep311 opened 4 years ago

lshep311 commented 4 years ago

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.

lornajane commented 4 years ago

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

lornajane commented 4 years ago

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 commented 3 years ago

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