Forum Discussion

michael-r's avatar
11 years ago

Popular Community Topics into Email Templates

Hi everyone, 

 

We are looking to pull in the most popular topics from our community and have these displayed within the daily digest email that we send out. 

 

We have attempted to do this by putting the following calls into the email template:

 

 <#assign messages=rest("/topics/style/blog/recent?page_size=3").messages />

          <#list messages.message as message>

          <#assign msg=rest("/messages/id/${message.id}").message >

          <#assign articlesubject = rest("/messages/id/${message.id}/subject").value>

          <#assign body = msg.teaser?replace("<(.|\n)*?>", "", "r")> <a href="${message.@view_href}">${message.subject}</a></p>

        <div class="left-column-content" align="left"> <#if body?string?length gt 250> ${body?substring(0, 247)}... <#else>${body}</#if> <a href="${message.@view_href}"><b>read more</b></a> </div>

        </#list>

 

When I try to save this within studio, I get an error. Is there an alternative method we can use to pull in the most popular Community topics into this email template?

 

Thanks, 

 

4 Replies

  • HaidongG's avatar
    HaidongG
    Lithium Alumni (Retired)
    11 years ago

    Hi Michael,

     

    Email template is with velocity, you can't use any freemarker syntax there, neither rest calls. only pre-defined variables listed here can be used inside your email template.

     

     

  • michael-r's avatar
    michael-r
    Maven
    11 years ago
    Thanks for the reply HaidongG.

    I've had a look at the velocity objects and not sure how this can be used to pull in the most active Community topics, presumably this isn't possible?
  • PaoloT's avatar
    PaoloT
    Lithium Alumni (Retired)
    11 years ago

    Hi michael-r 

     

    it is currently not possible to use REST calls in the e-mail templates (see here). This could be an idea to submit here - I am sure there are quite a few interesting use cases for this.

     

    Thanks,