Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] [Directline] Correlate messages sent by the app #1201

Closed
jmendiara opened this issue Sep 9, 2016 · 5 comments
Closed

[Question] [Directline] Correlate messages sent by the app #1201

jmendiara opened this issue Sep 9, 2016 · 5 comments
Assignees

Comments

@jmendiara
Copy link
Contributor

Is there a way to correlate messages sent from the app with those managed by directline?

I want to implement this use case (think in Whatsapp UI)

  1. The app starts a conversartion and starts polling that conversation with a POLLING request (GET /api/conversations/XYZ/messages)
  2. The user enters the message hello in my app
  3. The app shows the message hello in the conversation list with status: Unsent ( -- -- )
  4. The app sends the the message with a SEND request (POST /api/conversations/XYZ/messages), and before the request ends...
  5. The POLLING request returns me the hello message
  6. The app updates the UI, setting the message status to Sent ( ✓ -- )
  7. The SEND request completes, meaning the hello message has been delivered to the bot (not sure about that!)
  8. The app updates the UI, setting the message status to Received ( ✓ ✓ )

In the DirectLine API Docs for Sending a message (the SEND request in the use case) you say id (string, optional): ID for this message, but when the message is returned by the POLLING request, the payload id is not the same I specified earlier in the SEND request
ex:

POST  /api/conversations/XYZ/messages {"id: "93d73e19dfa", "text": "hello", conversationId: "A35WUwHjoCj", ... }
GET  /api/conversations/XYZ/messages --> {"id": "A35WUwHjoCj|000000000000000001", "text": "hello", ...}

Not being able to correlate the app messages with the directline messages close us other use cases, like retries for failed messages in the app side, logging...

How can we achieve message correlation?

cc:\ @dandriscoll

@jmendiara
Copy link
Contributor Author

I've experimented that issuing a POST /api/conversations/XYZ/messages with "channelData", that payload is returned also in the GET /api/conversations/XYZ/messages request, so this can be used for correlation. Is this true?
Does also that "channelData"payload reach the bot?

@palmerabollo
Copy link
Contributor

I've checked that channelData reaches your bot under session.message.sourceEvent. But I'm also wondering if that is the best way to correlate messages.

@dandriscoll
Copy link
Member

Hi @jmendiara and @palmerabollo, we reassign IDs within the service, so that's not going to be a field you can use. ChannelData is indeed your best option.

@jmendiara
Copy link
Contributor Author

Thanks @dandriscoll! A documentation update on the web site clarifying DirectLine API payload meaning and would be much appreciated.

@dandriscoll
Copy link
Member

We've got a raft of documentation coming for the next release. I may patch up the old docs too a bit later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants