Solved

Adding a comment to a conversation in a custom channel

  • 12 December 2022
  • 1 reply
  • 64 views

Badge +2

To add a comment to a conversation, the API requires us to pass the conversation ID.

 

But when we create the conversation using the API in the custom channel, we do not get the conversation ID in the response.

 

The response for the above only gives us the following keys:

  1. conversation_reference
  2. message_uid
  3. status

To pass a comment after creating the conversation, we need the conversation ID.

How do we get this?

Sample response data:

data: {
    conversation_reference: 'i:16623333570-h:62fb674ca562f438cbaeba4c06_game_62e4fc8e73e3232322668b3efbe3',
    message_uid: 'fe445d0cb7b72a48460829e74fd82332fdcd',
    status: 'accepted'
  }

 

icon

Best answer by Javier - Developer Relations 12 December 2022, 18:46

View original

1 reply

Userlevel 5
Badge +8

You can call the GET /messages/:id endpoint using resource aliases with the message UID. 

 

In this case, we will call GET /messages/alt:uid:fe445d0cb7b72a48460829e74fd82332fdcd as a way to fetch the message by UID. 

 

The response from the API will contain a "_links.related.conversation" field containing the API URL to fetch the conversation; you can just add '/comments' on the end of that URL to find the URL required to add a comment to that conversation.

 

I hope that helps! Let me know if you have any further questions.

 

--Jason

Reply