FAQ Generator

Automatically generate comprehensive FAQs from documentation, support tickets, and sales calls.

This workflow analyzes customer questions, creates Q&A pairs, and formats them with SEO-optimized schema markup.

Implementation

1import { relay } from "@relayplane/workflows";
2
3const result = await relay
4 .workflow("faq-generator")
5
6 // Step 1: Extract common questions from multiple sources
7 .step("extract-questions")
8 .with("openai:gpt-4o")
9 .prompt(`Extract frequently asked questions from these sources:
10
11Support Tickets:
12{{supportTickets}}
13
14Sales Call Notes:
15{{salesNotes}}
16
17Product Documentation:
18{{productDocs}}
19
20Identify:
21- Most frequently asked questions (min 3 occurrences)
22- Questions causing confusion or support load
23- Questions from buying stage vs onboarding vs power users
24
25Return array of questions grouped by category.`)
26
27 // Step 2: Generate comprehensive answers
28 .step("write-answers")
29 .with("anthropic:claude-3.5-sonnet")
30 .depends("extract-questions")
31 .prompt(`Write clear, helpful answers for these FAQs:
32
33{{extract-questions.output}}
34
35Product Context:
36{{productContext}}
37
38For each answer:
39- Start with direct answer (1 sentence)
40- Provide context and details
41- Include example if applicable
42- Link to relevant docs
43- End with next step or related question
44
45Tone: Helpful, clear, professional
46Length: 50-150 words per answer`)
47
48 // Step 3: Optimize for search intent
49 .step("seo-optimize")
50 .with("openai:gpt-4o")
51 .depends("write-answers")
52 .prompt(`Optimize these FAQs for search engines:
53
54{{write-answers.output}}
55
56For each Q&A:
57- Rephrase question to match search queries (natural language)
58- Ensure answer includes relevant keywords
59- Suggest related questions for internal linking
60- Identify opportunities for featured snippets
61
62Return optimized version with metadata.`)
63
64 // Step 4: Generate FAQ schema markup
65 .step("generate-schema")
66 .with("anthropic:claude-3.5-sonnet")
67 .depends("seo-optimize")
68 .prompt(`Generate FAQ schema markup (JSON-LD) for these Q&As:
69
70{{seo-optimize.output}}
71
72Follow schema.org FAQPage format.
73Include all questions and answers.
74Ensure valid JSON structure.`)
75
76 .run({
77 supportTickets: ticketData,
78 salesNotes: callNotes,
79 productDocs: documentation,
80 productContext: "Enterprise workflow automation platform with AI capabilities",
81 });
82
83// Publish to help center
84await publishFAQ({
85 content: result.steps["seo-optimize"].output,
86 schema: result.steps["generate-schema"].output,
87 category: "General",
88});

Automated Updates

1// Monthly FAQ refresh based on new support tickets
2import { relay } from "@relayplane/workflows";
3
4async function monthlyFAQUpdate() {
5 const lastMonth = new Date();
6 lastMonth.setMonth(lastMonth.getMonth() - 1);
7
8 // Fetch recent tickets
9 const recentTickets = await getTickets({
10 since: lastMonth,
11 status: 'resolved',
12 limit: 500,
13 });
14
15 // Identify new common questions
16 const result = await relay
17 .workflow("faq-generator")
18 .step("find-new-questions")
19 .with("openai:gpt-4o")
20 .prompt(`Analyze these support tickets for NEW frequently asked questions:
21
22{{tickets}}
23
24Existing FAQ Topics:
25{{existingFAQs}}
26
27Identify questions asked 5+ times that aren't in existing FAQs.
28Rank by frequency and business impact.`)
29 .step("write-answers")
30 .with("anthropic:claude-3.5-sonnet")
31 .depends("find-new-questions")
32 .run({
33 tickets: recentTickets.map(t => t.description).join("\n\n"),
34 existingFAQs: await getExistingFAQTopics(),
35 });
36
37 // Review and publish
38 await notifyTeam({
39 channel: "#content-updates",
40 message: "New FAQ suggestions ready for review",
41 data: result.steps["write-answers"].output,
42 });
43}

Sample Output

1{
2 "@context": "https://schema.org",
3 "@type": "FAQPage",
4 "mainEntity": [
5 {
6 "@type": "Question",
7 "name": "How do I connect multiple AI providers in one workflow?",
8 "acceptedAnswer": {
9 "@type": "Answer",
10 "text": "You can mix different AI providers in a single workflow using the .with() method. Each step can use a different provider by specifying provider:model format, such as .with('openai:gpt-4o') or .with('anthropic:claude-3.5-sonnet'). The workflow automatically handles authentication and provider switching between steps. See our multi-provider guide for examples."
11 }
12 },
13 {
14 "@type": "Question",
15 "name": "What's the difference between local and cloud execution?",
16 "acceptedAnswer": {
17 "@type": "Answer",
18 "text": "Local execution runs workflows entirely on your infrastructure using your own API keys. Cloud execution adds managed features like webhooks, scheduling, team collaboration, and usage analytics. You can develop locally and deploy to cloud seamlessly - the same code works in both environments. See pricing for cloud feature details."
19 }
20 }
21 ]
22}

Benefits

  • Reduced Support Load: Comprehensive FAQs deflect 30-40% of tickets
  • SEO Benefits: FAQ pages rank well for long-tail queries
  • Self-Service: Customers get instant answers 24/7
  • Always Current: Auto-update based on actual customer questions
Featured Snippets: FAQ schema markup increases chances of appearing in Google's featured results by 3-5x

Customization

  • Add video script generation for FAQ videos
  • Create chatbot training data from FAQs
  • Generate multilingual versions
  • A/B test different answer formats