Skip to content

Data Flow

Dejan Kovacevic edited this page Jan 23, 2017 · 1 revision

User Creates new conversation

-XPOST /conversations

User Adds service to conversation (this could be existing conversation or newly created empty one)

-XPOST /conversations/f0dc6989-f862-4c53-a257-06044cd23d41/bots -d '
{
    "provider": "72c39282-8d88-47a5-a11e-73c965be48fe",
    "service": "6ecb0d92-7c16-412a-9d7f-74624b6e9d00"
}'

Wire Backend (BE) calls:

-XPOST /bots -d'
{
    "client": "f0f4028e753cb7cc", 
    "conversation": {
        "id": "f0dc6989-f862-4c53-a257-06044cd23d41", 
        "members": [
            {
                "id": "fed64a84-4df0-420a-ae6f-a1ff7ff41ea9", 
                "status": 0
            }
        ], 
        "name": "propeller"
    }, 
    "id": "4d7e590d-1dd4-43c6-a88b-ccc49ab00efd", 
    "locale": "en", 
    "origin": {
        "accent_id": 5, 
        "id": "fed64a84-4df0-420a-ae6f-a1ff7ff41ea9", 
        "name": "Dejan"
    }, 
    "token": "GPq5ToXOz34QbKw4Sfs4n1sv9eOV2Y6aodZiWIE8zr3joSyvg5NjWe82ajNOMz3wIPCZFU7eBly4cT8-F3yZAg==.v=1.k=1.d=-1.t=b.l=.p=d39b462f-7e60-4d88-82e1-44d632f94901.b=4d7e590d-1dd4-43c6-a88b-ccc49ab00efd.c=f0dc6989-f862-4c53-a257-06044cd23d41"
}'

Bot Service should return this:

code 201

{
    "accent_id": 2, 
    "assets": [], 
    "last_prekey": {
        "id": 65535, 
        "key": "pQABARn//wKhAFggd3fMn/oZHeOG4Xwr9YqIJCF+SW/kbClaTQgBLd487eIDoQChAFggDa9VSAk0VLxvbu73LL9lFZyjwMhLwH/GMiX61SXl6pUE9g=="
    }, 
    "name": "Propeller", 
    "prekeys": [
        {
            "id": 0, 
            "key": "pQABAQACoQBYIE9nsN80mjipS9Xkrhc4P+AnmoSWFVRz9EI3I8j7MX/SA6EAoQBYIA2vVUgJNFS8b27u9yy/ZRWco8DIS8B/xjIl+tUl5eqVBPY="
        }, 
        {
            "id": 1, 
            "key": "pQABAQECoQBYIObhD58rOP5kDJfcB9vZiP+sMm5mzbFnR1bFzz+B2sflA6EAoQBYIA2vVUgJNFS8b27u9yy/ZRWco8DIS8B/xjIl+tUl5eqVBPY="
        }, 
        {
            "id": 2, 
            "key": "pQABAQICoQBYIGwJR8fARgBExG7mLPPWqS3JmUFRgzoRgkN/RP0kpjveA6EAoQBYIA2vVUgJNFS8b27u9yy/ZRWco8DIS8B/xjIl+tUl5eqVBPY="
        }, 
        {
            "id": 3, 
            "key": "pQABAQMCoQBYILWQqMPXqXj3frs+ZP13dUKyVXEvyw46IUEwKlT1Iv6MA6EAoQBYIA2vVUgJNFS8b27u9yy/ZRWco8DIS8B/xjIl+tUl5eqVBPY="
        }, 
        {
            "id": 4, 
            "key": "pQABAQQCoQBYIJFGPkAPpb2kyYy9b6HPJa7YeCb7FmN3nMVjLvnBg/2FA6EAoQBYIA2vVUgJNFS8b27u9yy/ZRWco8DIS8B/xjIl+tUl5eqVBPY="
        }, 
        {
            "id": 5, 
            "key": "pQABAQUCoQBYIKhOPFtTcbWroqhyBOmStGUlOoSxOyInmBeUmnRtb72qA6EAoQBYIA2vVUgJNFS8b27u9yy/ZRWco8DIS8B/xjIl+tUl5eqVBPY="
        }, 
        {
            "id": 6, 
            "key": "pQABAQYCoQBYIGpDIVVXVBsdzlL/5NC9Qma+Y1JXaELI/CLqAHvDyRP4A6EAoQBYIA2vVUgJNFS8b27u9yy/ZRWco8DIS8B/xjIl+tUl5eqVBPY="
        }, 
        {
            "id": 7, 
            "key": "pQABAQcCoQBYIHHq5X7D4Rh4eJwL16zJTOQr3YUuscBD9USQSy7N9pzxA6EAoQBYIA2vVUgJNFS8b27u9yy/ZRWco8DIS8B/xjIl+tUl5eqVBPY="
        }
    ]
}

Then BE calls this:

-XPOST /bots/4d7e590d-1dd4-43c6-a88b-ccc49ab00efd/messages -d'
{
    "conversation": "f0dc6989-f862-4c53-a257-06044cd23d41", 
    "data": {
        "user_ids": [
            "4d7e590d-1dd4-43c6-a88b-ccc49ab00efd"
        ]
    }, 
    "from": "fed64a84-4df0-420a-ae6f-a1ff7ff41ea9", 
    "time": "2016-12-20T16:20:42.472Z", 
    "type": "conversation.member-join"
}'

When new text is posted to this conv BE calls this:

-XPOST /bots/4d7e590d-1dd4-43c6-a88b-ccc49ab00efd/messages -d'
{
    "conversation": "f0dc6989-f862-4c53-a257-06044cd23d41", 
    "data": {
        "recipient": "f0f4079e753cb7cc", 
        "sender": "d92dd2687d60cb0a", 
        "text": "owABAaEAWCCiVHJECgbboMzu0Bz0MGRsJYfxGzf1/hU6J+ikU5i/rwJYcAGlAFCCvP3M0lPzLum43CgdyXy+AQACAAOhAFggrAmzIiyFs4TztaBk6LRTqQEWi09Bt2Tz7u09/qriaisEWDD0JsX/YPZR9hdAFea1YOdRFW9eNF92VTkkXnKOImGDLUWUjyt02c9pn1uYz3TU0us=", 
    }, 
    "from": "fed64a84-4df0-420a-ae6f-a1ff7ff41ea9", 
    "time": "2016-12-20T16:21:52.877Z", 
    "type": "conversation.otr-message-add"
}'