Skip to main content

Scenario

G2 reviews include the reviewer’s role, company size, and industry. A VP of Marketing experiences your product differently than a DevOps engineer. You pull reviews segmented by reviewer role, create Mavera personas grounded in actual reviewer profiles, then generate role-targeted marketing content that speaks to what each persona actually cares about — using their own words. Flow: G2 GET /survey-responses → Group by reviewer role → Mavera POST /personasPOST /generations (role-targeted content)

Architecture

Code

Example Output

Error Handling

G2 uses Token token={key} (not Bearer). Using the wrong format returns 401. Check the exact header format in your G2 API documentation.
The comment_answers field structure varies by survey version. Some are flat strings, others are {text, id} objects. The code handles both formats.
Reviewer titles can be verbose (“Vice President of Marketing & Communications”). The code splits on comma and takes the first part. For better grouping, use a role-normalization function.