I work on a android chat application. I use Twitter apis.I get user direct messages as event. I want to merge messages in Twitter Direct Messages Api Event Response.

Data Struct of Response has sender_id and recipient_id. I want to make chat window. I tried merge messages between two person but i cant it. How can i do this?

Example response :

    "events": [
        {
            "type": "message_create",
            "id": "00000000000",
            "created_timestamp": "1557629578263",
            "message_create": {
                "target": {
                    "recipient_id": "00000000000"
                },
                "sender_id": "0000000",
                "source_app_id": "000000",
                "message_data": {
                    "text": "0000",
                    "entities": {
                        "hashtags": [
                            {
                                "text": "00000",
                                "indices": [
                                    0,
                                    6
                                ]
                            }
                        ],
                        "symbols": [],
                        "user_mentions": [],
                        "urls": []
                    }
                }
            }
        },
        {
            "type": "message_create",
            "id": "00",
            "created_timestamp": "1557576702974",
            "message_create": {
                "target": {
                    "recipient_id": "xxxx"
                },
                "sender_id": "yyyyy",
                "message_data": {
                    "text": ":D",
                    "entities": {
                        "hashtags": [],
                        "symbols": [],
                        "user_mentions": [],
                        "urls": []
                    }
                }
            }
        },
        {
            "type": "message_create",
            "id": "0000000",
            "created_timestamp": "1557576699106",
            "message_create": {
                "target": {
                    "recipient_id": "yy"
                },
                "sender_id": "xxx",
                "message_data": {
                    "text": "",
                    "entities": {
                        "hashtags": [],
                        "symbols": [],
                        "user_mentions": [],
                        "urls": []
                    }
                }
            }
        }
    ],
    "apps": {
        "aaa": {
            "id": "aaaa",
            "name": "Twitter Web Client",
            "url": "http://twitter.com"
        }
    }
}</i>```

0 Answers