Transitioning Front Chat conversations to email via Zapier

  • 5 October 2023
  • 0 replies
  • 53 views

Userlevel 4
Badge +7

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 };
}

 


0 replies

Be the first to reply!

Reply