Spaces:
Running

File size: 7,708 Bytes
c1ffd47
 
 
c3711da
5277c5d
 
 
 
 
 
 
 
34d1b11
 
 
7191d88
5277c5d
34d1b11
5277c5d
34d1b11
c3711da
c1ffd47
 
 
 
 
 
c3711da
 
c1ffd47
 
 
 
 
 
c3711da
 
c1ffd47
 
 
 
 
 
c3711da
 
c1ffd47
 
 
 
 
 
c3711da
 
c1ffd47
 
 
 
 
 
c3711da
 
c1ffd47
 
 
 
 
 
 
 
 
 
 
 
 
 
c3711da
 
 
cb04a74
 
c3711da
 
 
 
5277c5d
 
 
 
 
 
 
 
 
 
 
 
 
 
cb04a74
 
 
 
 
 
c1ffd47
c3711da
c1ffd47
 
 
 
 
c3711da
cb04a74
c3711da
 
 
06ae444
c3711da
 
 
 
 
 
 
 
 
cb04a74
 
c3711da
 
 
 
06ae444
5277c5d
 
 
c3711da
5277c5d
c3711da
 
 
cb04a74
5277c5d
c3711da
06ae444
c3711da
 
5277c5d
 
c3711da
 
06ae444
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
// Add a new article by copying an item below and updating its title, date,
// category, excerpt, URL, and cover image. Categories are generated from the
// article data, so the filter buttons stay in sync as the collection changes.
const posts = [
  {
    title: "Estée Lauder Chooses 3Chat.ai 🎉",
    date: "2026-11-25",
    category: "Customer Stories",
    excerpt: "Estée Lauder, a global prestige beauty brand, is using 3Chat.ai to help its retail teams respond to product inquiries, understand what shoppers are looking for, and follow up with customers on WeCom.",
    url: "https://www.3chat.ai/blog/3chat-ai-new-customer-estee",
    cover: "https://cdn.sanity.io/images/tk1fijeo/3chat-blog-data-intl/2f0876688a6f00ca20df5534b4bdcbd4a105a949-3840x2160.png?w=1024&auto=format"
  },
  {
    title: "3Chat AgentRuntime: Designing an Agent Runtime for Conversational Marketing",
    date: "2026-10-28",
    category: "Technology",
    excerpt: "Most mainstream agent frameworks and runtimes are built around tasks: a user gives an instruction, and the agent works through a loop of thinking, calling tools and observing results until the task is done. Conversational marketing is a different problem.",
    url: "https://www.3chat.ai/blog/3chat-agentruntime-designing-an-agent-runtime-for-conversational-marketing",
    cover: "https://cdn.sanity.io/images/f1joviv1/3chat-blog-data-intl/8c24c0ebfb1468e35de8fc7d6f9c57be9da6e450-11561x6480.png?w=1024&auto=format"
  },
  {
    title: "30 Actionable WhatsApp Tips for 2025: Boost Your Strategy Today",
    date: "2025-11-01",
    category: "Daily Tips",
    excerpt: "A practical collection of WhatsApp features, privacy settings, media workflows, and productivity tips for global e-commerce teams.",
    url: "https://www.3chat.ai/blog/2025-whatsapp",
    cover: "https://cdn.sanity.io/images/f1joviv1/3chat-blog-data-intl/80692a7e5897a95835b937cd97b54b67e33e9a3c-1024x576.avif"
  },
  {
    title: "Omnichannel Setup: Integrating 3Chat.ai with WhatsApp",
    date: "2025-10-13",
    category: "How-to Guides",
    excerpt: "Learn how to connect WhatsApp to 3Chat.ai, manage conversations in one inbox, and prepare your account and network before scanning the QR code.",
    url: "https://www.3chat.ai/blog/omnichannel-3chat-ai-whatsapp",
    cover: "https://cdn.sanity.io/images/f1joviv1/3chat-blog-data-intl/015b228fe8f4434126b9be6f0e4dd907239f30fd-1024x576.avif"
  },
  {
    title: "Omnichannel Setup: Integrating 3Chat.ai with Facebook",
    date: "2025-10-13",
    category: "How-to Guides",
    excerpt: "Follow the steps to connect a Facebook Business Account, authorize your Pages, and test Messenger conversations and Page comments in 3Chat.ai.",
    url: "https://www.3chat.ai/blog/3chat-ai-facebook",
    cover: "https://cdn.sanity.io/images/f1joviv1/3chat-blog-data-intl/8cc57484dcbc1343e13ed47f058ad857a890e7e8-1024x576.avif"
  },
  {
    title: "Mastering Amazon Precision Operations: Integrating AI for Scalable Success",
    date: "2025-10-11",
    category: "Daily Tips",
    excerpt: "Explore a practical operating system for Amazon sellers, from account health and customer service to reviews, ads, inventory, and AI-assisted growth.",
    url: "https://www.3chat.ai/blog/in-depth-insight-amazon-refined-operation-integration-and-practice-of-ai-customer-service-tools",
    cover: "https://cdn.sanity.io/images/f1joviv1/3chat-blog-data-intl/756ceb7c9829b37a10018bf18cf1d1c0699a6aae-1024x576.webp"
  },
  {
    title: "Agentic AI: Game-Changing Tech or Just Marketing Hype?",
    date: "2025-09-12",
    category: "Deep Dives",
    excerpt: "A grounded look at what Agentic AI means, how it differs from traditional automation, and where AI agents are already creating business value.",
    url: "https://www.3chat.ai/blog/agentic-ai",
    cover: "https://cdn.sanity.io/images/f1joviv1/3chat-blog-data-intl/0046169aee56e0f75a720689f4c36ff6264bfbca-1024x576.webp"
  },
  {
    title: "E-commerce Growth Secrets: How to Skyrocket Conversions via WhatsApp",
    date: "2025-09-08",
    category: "Daily Tips",
    excerpt: "Understand why WhatsApp matters for cross-border commerce and how AI-powered customer support can turn private conversations into long-term growth.",
    url: "https://www.3chat.ai/blog/whatsapp-independent-site-conversions",
    cover: "https://cdn.sanity.io/images/f1joviv1/3chat-blog-data-intl/6ddfaace52226c39e098318a433beb2a3a8be128-1024x576.avif"
  },
  {
    title: "The Future of Support: How RAG, Agents, and MCP are Reimagining Customer Service",
    date: "2025-08-19",
    category: "Deep Dives",
    excerpt: "A plain-language introduction to RAG, intelligent agents, function calling, and MCP—and how these technologies work together in customer support.",
    url: "https://www.3chat.ai/blog/rag-agent-mcp-transforming-customer-service",
    cover: "https://cdn.sanity.io/images/f1joviv1/3chat-blog-data-intl/cd0875d28a9c5f3c92480eaf6afa27354d8d3991-1024x576.avif"
  }
];

const ALL_CATEGORY = "__all__";

const postList = document.querySelector("[data-post-list]");
const categoryList = document.querySelector("[data-category-list]");
const countLabel = document.querySelector("[data-post-count]");

const withUtm = (rawUrl) => {
  try {
    const parsed = new URL(rawUrl);
    const slug = parsed.pathname.split("/").filter(Boolean).pop() || "article";
    parsed.searchParams.set("utm_source", "huggingface");
    parsed.searchParams.set("utm_medium", "referral");
    parsed.searchParams.set("utm_campaign", "hf_blogs");
    parsed.searchParams.set("utm_content", slug);
    return parsed.toString();
  } catch {
    return rawUrl;
  }
};

const formatDate = (date) => new Intl.DateTimeFormat("en-US", {
  year: "numeric",
  month: "short",
  day: "numeric"
}).format(new Date(`${date}T00:00:00`));

const categoryLabel = (category) => category;

// Derive filters from the current posts instead of maintaining a separate list.
const categories = [
  ALL_CATEGORY,
  ...Array.from(new Set(posts.map((post) => post.category))).sort((a, b) => a.localeCompare(b))
];

function renderCategories(activeCategory = ALL_CATEGORY) {
  categoryList.innerHTML = categories
    .map((category) => `
      <button class="filter-button ${category === activeCategory ? "is-active" : ""}" type="button" data-category="${category}">
        ${category === ALL_CATEGORY ? "All" : categoryLabel(category)}
      </button>
    `)
    .join("");

  categoryList.querySelectorAll("[data-category]").forEach((button) => {
    button.addEventListener("click", () => renderPosts(button.dataset.category));
  });
}

function renderPosts(activeCategory = ALL_CATEGORY) {
  const visiblePosts = activeCategory === ALL_CATEGORY
    ? posts
    : posts.filter((post) => post.category === activeCategory);

  renderCategories(activeCategory);
  countLabel.textContent = `${visiblePosts.length} articles`;
  postList.innerHTML = visiblePosts.map((post) => {
    const trackedUrl = withUtm(post.url);
    return `
    <article class="post-card">
      <a class="post-image" href="${trackedUrl}" target="_blank" rel="noopener">
        <img src="${post.cover}" alt="${post.title}" loading="lazy">
      </a>
      <div class="post-content">
        <div class="post-meta"><span class="tag">${categoryLabel(post.category)}</span><time datetime="${post.date}">${formatDate(post.date)}</time></div>
        <h2><a href="${trackedUrl}" target="_blank" rel="noopener">${post.title}</a></h2>
        <p>${post.excerpt}</p>
        <a class="read-link" href="${trackedUrl}" target="_blank" rel="noopener">Read full article <span aria-hidden="true">↗</span></a>
      </div>
    </article>
  `;
  }).join("");
}

renderPosts();