How to fetch sender of a selected message with Context API?

  • 28 March 2023
  • 1 reply


For a plugin I developed, I want to prefill the email or telephone number (dependent on the message) of the sender of that message. I can’t find which method I need to use to fetch that info of the sender. Is there a way I can do this and, if so, which method do I use?

Thanks in advance!


Best answer by Support Engineering 28 March 2023, 19:42

View original

1 reply

Userlevel 1
Badge +5

Hi Annemijn! 👋

The properties within context are conversations, conversation and draftId. As a result, a specific message is not able to be selected, since a conversation is selected and all messages are presented within that given conversation. To achieve selecting a single message from a selected conversation, I would recommend utilizing the conversation property and obtaining the id of the conversation. From there, you could use the ‘List conversation messages’ endpoint to fetch all messages of a conversation. Using your own logic to determine which message in the returned payload you want to focus on, you will see that each message object contains a recipients array. Here you could find the details regarding the message’s sender.

  "recipients": [
"_links": {
"related": {
"contact": "string"
"name": "string",
"handle": "string",
"role": "from"

Hope this helps clarify! Let us know if you have any other questions!

- Justin