API To Fetch Topics From Community With No Response

2 Comentarios

  • Tipene Hughes
    Zendesk Developer Advocacy
    Hey, Sean!
    Unfortunately the Topics API does not provide a list of posts made to a given topic. One possible way you could go about this is by pulling a list of posts and filtering those from the last 7 days, then comparing the topic IDs of the posts to a list of topics from your community instance. Here’s a basic example using Javascript in the context of the Zendesk Apps framework:
    const getTopics = async () => {
    // gets date from seven days ago
    const sevenDaysAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString().split('T')[0];

    // gets community topics
    const topicsData = await client.request("/api/v2/community/topics");

    // gets posts not older than seven days
    const postsData = await client.request(

    // stores topic IDs
    let recentTopics = [];
    let topicsWithReplies = [];

    // Checks for and stores topics that are equal to or less than seven days old
    topicsData.topics.map((topic) => {
    const createdAt = new Date(topic.created_at);
    if (createdAt >= new Date(sevenDaysAgo)) {

    // Checks if posts have been made in topics retrieved above
    postsData.results.map((post) => {

    // Print results to console

    Feel free to reach out if you have any questions!
  • Sean Jago

    Wow, thanks for the incredibly detailed response! I will give it a try.


Iniciar sesión para dejar un comentario.

Tecnología de Zendesk