Forum Discussion

Shivshankar's avatar
8 years ago

Unable to parse Event subscription response

I have subscribe to event "MessageUpdate" , accordingly we get 3 parameters 

1) Token 2) message 3) event.type 

using freemarker i want to check what is xml response received in message.

following is freemarker code i am using 

 

<#assign msgToken = http.request.parameters.name.get("token","") />
<#assign msgEvent = http.request.parameters.name.get("event.type","") />
<#assign msgNode = http.request.parameters.name.get("message","") />

<#assign response = restadmin("postoffice/notes/send?notes.recipient=/users/id/[id]&notes.subject=Testing&notes.note=${msgToken}+${msgNode}").response /> 

 

by this code i am trying to send private message to user having "msgToken" and "msgNode"(message) as content but unable to receive message. When i remove messageNode , the message shows up. Why is this problem occurring? Any other way we can print xml response.

  • Hi Shivshankar

    In the above code you also have to request users userid parameter for the user u want to send email, for more information I have added example code below:

    <#assign userId = http.request.parameters.name.get("userId","") />
    <#assign msgToken = http.request.parameters.name.get("token","") />
    <#assign msgEvent = http.request.parameters.name.get("event.type","") />
    <#assign msgNode = http.request.parameters.name.get("message","") />

    <#assign responses = restadmin("postoffice/notes/send?notes.recipient=/users/id/${userId}&notes.subject=Testing&notes.note=${msgToken}+${msgNode}") />
    <#list responses as response>
    ${response.@status}
    </#list>

    You can also add this to an endpont and a make call endpoint by passing the requested parameters.