1

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

albert
  • 8,112
  • 3
  • 47
  • 63

2 Answers2

1
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

quikst3r
  • 1,783
  • 1
  • 10
  • 15
0

The config api is very picky. I managed to get it to work by using the following POST request, I used Postman. The key was to send an empty object as the features value:

POST /v1/config HTTP/1.1
Host: api.kik.com
Content-Type: application/json
Authorization: Basic --------- my auth token -----------------
Cache-Control: no-cache
Postman-Token: 217953a0-64da-556e-6817-5309bf4b92e8

{ 
    "webhook": "https://kwcraftbeer.azurewebsites.net/incoming",
    "features": {}

}
Joe Capka
  • 562
  • 4
  • 17
  • This is what I've got.. are you getting null for webhook too? { "webhook": null, "features": { "receiveReadReceipts": false, "receiveIsTyping": false, "manuallySendReadReceipts": false, "receiveDeliveryReceipts": false } } – Leg0 Apr 06 '16 at 09:47
  • ok, if anyone stumbles on the same problem, I have to use http, not https – Leg0 Apr 06 '16 at 09:54
  • I'm pretty sure you've got to use https, they state as much in the docs. You are using basic auth after all. The response I get to that post is a 200 with {} as the body – Joe Capka Apr 06 '16 at 12:12
  • you do need to use HTTPS like [Joe Capka](http://stackoverflow.com/users/222956/joe-capka) mentions. I also used Postman to config my bot - I explain how [here](http://stackoverflow.com/questions/36717073/how-to-set-kik-bot-webhook/37400166#37400166). – kevin11 May 23 '16 at 21:06