Forum Discussion

vidhyut_arora's avatar
14 years ago

How to capture Private Message Note send via Freemarker or REST API?

Hi,

 

I am writing a custom component in which I want to fetch/capture the sender of a private message note. How can I do this?

 

I am able to get the subject and the body of a private message using the tags "$note.subject" & "$note.body" successfully.

 

 

Thanks in advance.

Vidhyut Arora

3 Replies

  • AdamN's avatar
    AdamN
    Khoros Oracle
    14 years ago

    Hi vidhyut_arora,

     

    A sample response looks like this:

    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <response status="success">
      <note type="note" href="/users/id/5/mailbox/notes/id/45">
        <body type="string" null="true"/>
        <subject type="string" null="true"/>
        <sent_time type="date_time">2006-07-18T22:13:26+00:00</sent_time>
        <recieved_time type="date_time">2006-07-21T08:48:14+00:00</recieved_time>
        <to type="user" href="/users/id/43">
          <login type="string">john_doe</login>
        </to>
        <from type="user" href="/users/id/43">
          <login type="string">john_doe</login>
        </from>
        <id type="int">413</id>
      </note>
    </response>

     

    So if the variable note contains the response of the note from the REST API, you should be able to access the sender and recipient via $note.from.login and $note.to.login respectively.

     

    I hope this helps!

  • Thanks Adam for your response.

     

    However, I tried $note.from.login but am not getting the value.

     

    Further clarification, I am trying to use this for setting the value of one of the 'text_key' in Lithium Studio -> Text Editor

     

     

    Thanks,

  • AdamN's avatar
    AdamN
    Khoros Oracle
    14 years ago

    We were able to resolve this with Vidhyut outside the community, but I wanted to follow up here to let everyone know the resolution in case anyone else had a similar question.

     

    Vidhyut was trying to update the pm_notification e-mail template via Studio to include the name of the user that sent the private message. We advised Vidhyut to use ${note.fromLogin}