const Vonage = require('@vonage/server-sdk')

const smsSender = new Vonage({
    apiKey: "b0216415",
    apiSecret: "Cp9wQAHA2DhxUVHi"
})

const smsError = (err, responseData) => {
    if (err) {
        console.log(err);
    } else {
        if(responseData.messages[0]['status'] === "0") {
            console.log("Message sent successfully.");
        } else {
            console.log(`Message failed with error: ${responseData.messages[0]['error-text']}`);
        }
    }
}

module.exports = {
    smsSender,
    smsError
}
