I was recently asked how to automatically transition a Front Chat conversation into an email thread. While there’s not currently a way to do this natively in Front, using a rule and basic Zap allows you to build a quick automation to turn a chat conversation into an email thread.
There’s plenty that could be improved about this approach, but I hope it serves as a good template for building an automation like this.
The JS code from the Zapier Code step shown in the screencast is:
try {
// Fetch the contact info
const res = await fetch(inputData.contactUrl, {
headers: { Authorization: 'Bearer YOUR_API_TOKEN' }
});
const contact = await res.json();
const emailHandle = contact.handles.find((h) => h.source === 'email').handle
if (!emailHandle) {
return {error: {message: "No email handle found"}}
}
return {email: emailHandle}
} catch (error) {
return { error };
}