user2578348 user2578348 - 3 months ago 11
JSON Question

How to get chat id with Kik Api

I've created code with the Kik Api in Python 3.5, but I've come to a stand still when I am trying to get the chat id. I have searched, but I have no idea to use the api to find a chat id to send messages to. How do you get the chat id with the api? My code is here: http://pastebin.com/LP8ahhhd

Answer

When you receive a message it will look something like this

{
    "messages": [
        {
            "chatId": "0ee6d46753bfa6ac2f089149959363f3f59ae62b10cba89cc426490ce38ea92d",
            "id": "0115efde-e54b-43d5-873a-5fef7adc69fd",
            "type": "text",
            "from": "laura",
            "participants": ["laura"],
            "body": "omg r u real?",
            "timestamp": 1439576628405,
            "readReceiptRequested": true,
            "mention": null
        },
        {
            "chatId": "0ee6d46753bfa6ac2f089149959363f3f59ae62b10cba89cc426490ce38ea92d",
            "id": "74ded818-1eb7-4266-91bc-c301c2f41fe3",
            "type": "picture",
            "from": "aleem",
            "participants": ["aleem"],
            "picUrl": "http://example.kik.com/apicture.jpg",
            "timestamp": 1439576628405,
            "readReceiptRequested": true,
            "mention": null
        }
    ]
}

You can grab the appropriate chatId from the chatId of the message you received

Comments