0

我正在尝试处理 gupshup viber 机器人上的订阅事件。我认为我必须在 EventHandler 上做点什么,但我不知道。当我在 viber 中为用户订阅机器人时,EventHandler 不会触发。

function MessageHandler(context, event) {
    context.sendResponse("This is a response from Message Handler: \n Message: " + event.message + ", \n ID: " + event.sender + ", \n Name: " 
    + event.senderobj.display );
}

function EventHandler(context, event) {
    //something here 
    context.sendResponse("This is a Response From Event Handler -- >" + event.message);
}

function HttpResponseHandler(context, event) {
    if (event.geturl === "http://ip-api.com/json")
        context.sendResponse('This is response from http \n' + JSON.stringify(event.getresp, null, '\t'));
}

function DbGetHandler(context, event) {
    context.sendResponse("testdbput keyword was last sent by:" + JSON.stringify(event.dbval));
}

function DbPutHandler(context, event) {
    context.sendResponse("testdbput keyword was last sent by:" + JSON.stringify(event.dbval));
}

function HttpEndpointHandler(context, event) {
    context.sendResponse('This is response from http \n' + JSON.stringify(event, null, '\t'));
}

function LocationHandler(context, event) {
    context.sendResponse("Got location");
}

exports.onMessage      = MessageHandler;
exports.onEvent        = EventHandler;
exports.onHttpResponse = HttpResponseHandler;
exports.onDbGet        = DbGetHandler;
exports.onDbPut        = DbPutHandler;
if (typeof LocationHandler == 'function') {
    exports.onLocation = LocationHandler;
}
if (typeof HttpEndpointHandler == 'function') {
    exports.onHttpEndpoint = HttpEndpointHandler;
}

有什么帮助吗?提前谢谢

4

0 回答 0