Search code examples
botskik

bot configuration on kik is not working as expected


I am trying to create an echo bot on kik. I have followed dev.kik.com, created a bot but then when i am trying to configure the bot, it does nothing(no message on kik or my middleware).

set up: 1. I have echo bot implemented using nodejs and hosted on azure. I have tested with AdvanceREST and i know that if the message is received correctly, it does respond back. 2. I have tried sending my bot configuration as below via nodejs request module.

request.post({
    url : 'https://api.kik.com/v1/config',
    auth: {
            'user' : 'botname',
            'pass' : 'botkey'
        }, 
    headers:{
        'Content-Type': 'application/json'
    },
    form :JSON.stringify({
        "webhook": "https://myurl",
        "features": {
           "manuallySendReadReceipts": false,
           "receiveReadReceipts": false,
           "receiveDeliveryReceipts": false,
           "receiveIsTyping": false
        }
    }) 
}, function(err,httpResponse,body){
        if(err){
            res.send(err);
        }
        if(httpResponse.statusCode === 200){
            res.send(JSON.parse(body));    
        }

    });

any help in this regard is greatly appreciated... thanks


Solution

  • request.post({
        url : 'https://api.kik.com/v1/config',
        auth: {
                'user' : 'botname',
                'pass' : 'botkey'
            }, 
        headers:{
            'Content-Type': 'application/json'
        },
        json: true,
        body :{
            "webhook": "https://myurl.com/incoming",
            "features": {
               "manuallySendReadReceipts": false,
               "receiveReadReceipts": false,
               "receiveDeliveryReceipts": false,
               "receiveIsTyping": false
            }
        }
    }, function(err,httpResponse,body){
        if(err){
            res.send(err);
        }
        if(httpResponse.statusCode === 200){
            res.send(JSON.parse(body));    
        }
    });
    

    This should work a) ensure your url is valid, I know you just had a placeholder there but b) Use json:true and the key body it will work

    You could also checkout kik's node library https://www.npmjs.com/package/@kikinteractive/kik which can set a config easily