如何与Kik Api聊天

时间:2016-08-15 04:39:36

标签: python json api kik

我在Python 3.5中使用Kik Api创建了代码,但是当我试图获取聊天ID时,我已经停下来了。我搜索过,但我不知道使用api找到一个聊天ID来发送消息。你如何获得api的聊天ID?我的代码在这里:http://pastebin.com/LP8ahhhd

2 个答案:

答案 0 :(得分:0)

如果我没有弄错,你发布的代码中有一个chatID字段?您需要使用它将消息发送回同一个对话。有关详细信息,请参阅此处:https://dev.kik.com/#/docs/messaging#sending-messages

答案 1 :(得分:0)

当您收到消息时,它将看起来像这样

{
    "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
        }
    ]
}

您可以从收到的邮件的chatId中抓取相应的chatId