Quick overview
This workflow runs daily, pulls campaign stats and reply conversations from HeyReach, sends them to Twain for performance analysis, and posts a digest to Slack with optional one-click approval to apply Twain’s suggested agent updates.
How it works
- Scheduled run
- Iterates through the configured pairs of Twain campaign IDs and HeyReach campaign IDs.
- Fetches the HeyReach campaign details, overall performance stats, and recent inbox conversations for each campaign.
- Packages key metrics and recent message threads and sends them to Twain’s /v2/Campaign/Analyze endpoint for analysis and optimization suggestions.
- Builds a Slack digest with health signals, reply themes, step diagnostics, and proposed agent changes (plus a link to the campaign in Twain when available).
- If there are actionable agent changes, posts the digest to Slack with Approve/Skip buttons and applies the approved changes via Twain’s /v2/Agent/Update, then confirms success or errors in Slack.
- If there are no changes, posts the digest only when the analysis is meaningful (for example, analyzed results or alerts), then moves on to the next campaign.
Setup
- Add HeyReach API access using HTTP Header Auth credentials and ensure your key can call campaign, stats, and inbox endpoints.
- Add a Twain API key using HTTP Header Auth credentials (X-Api-Key) and confirm your Twain campaign IDs are correct.
- Add Slack credentials for a bot token and ensure the bot has permission to post and use interactive approvals in the target channel.
- In the Settings values, replace REPLACE_WITH_TWAIN_CAMPAIGN_ID and REPLACE_WITH_HEYREACH_CAMPAIGN_ID for each campaign pair, optionally set a focus string, and set the Slack channel name.
- Adjust the schedule time if needed and activate the workflow.
Requirements