Read messages
To read messages from a conversation, follow these steps:
- Extract the private key tied to the m/0/0path of your Twetch 12-word seed.
A JavaScript example can be found here.
- Get messages for a conversation from the graphqlendpoint:
HTTP POST request:
URL: https://api.twetch.app/v1/graphql
Headers: {
    Authorization: ‘Bearer <twetch_authorization_token>’
}
Body: {
    query:  `{
        allMessages(filter: {conversationId: {equalTo: "${convId}"}}) {
          nodes {
            createdAt
            description
            id
            userId
          }
        }
    }`
}
Response:
{
  "data": {
    allMessages: {
        nodes: [
            {
                createdAt: '2020-10-19T20:30:21.560123+02:00',
                description: 'eeaaf4cd',
                id: '1fb19cd0-8267-4070-b6f4-11e7dc31df35',
                userId: '17329'
            },
            {
                createdAt: '2020-10-19T20:14:57.387904+02:00',
                description: 'Windbell added Joshua Henslee ✪',
                id: '26786ee7-51fb-495b-860d-b3b95e33314e',
                userId: null
            },
            {
                createdAt: '2020-10-19T20:14:57.039349+02:00',
                description: 'Windbell created chat',
                id: '56cf9d72-fecf-41c9-a8fb-0641d309c169',
                userId: null
            }
        ]
    }
  }
}
- Fetch the encryption key just as in Step 2 of Sending a message. 
- ECIES decrypt the encryption key from Step 2. 
A JavaScript example can be found here.
- AES decrypt the descriptionfield returned from the API call in Step 1.
A JavaScript example can be found here.
