如何使用kikapi获取聊天id

2024-09-28 13:24:26 发布

您现在位置:Python中文网/ 问答频道 /正文

我已经用python3.5中的kikapi创建了代码,但是当我试图获取聊天id时,我陷入了停顿。我已经搜索过了,但是我不知道如何使用Api来找到一个聊天id来发送消息。如何使用api获取聊天id?我的代码在这里:http://pastebin.com/LP8ahhhd


Tags: 代码comapiidhttp消息pastebinkikapi
2条回答

当你收到一条信息时,它看起来像这样

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

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

相关问题 更多 >

    热门问题