Add Chatwoot livechat integration

Closes #159
This commit is contained in:
Baptiste Arnaud
2022-11-10 10:53:44 +01:00
parent 92147c315f
commit ea84039024
32 changed files with 464 additions and 62 deletions

View File

@@ -1,4 +1,5 @@
import { Log } from 'db'
import { openChatwootWidget } from 'features/chatwoot'
import {
IntegrationBlock,
IntegrationBlockType,
@@ -25,7 +26,7 @@ import { byId, sendRequest } from 'utils'
import { sendGaEvent } from '../../lib/gtag'
import { parseVariables, parseVariablesInObject } from './variable'
type IntegrationContext = {
export type IntegrationContext = {
apiHost: string
typebotId: string
groupId: string
@@ -59,6 +60,8 @@ export const executeIntegration = ({
return executeWebhook(block, context)
case IntegrationBlockType.EMAIL:
return sendEmail(block, context)
case IntegrationBlockType.CHATWOOT:
return openChatwootWidget(block, context)
}
}

View File

@@ -167,7 +167,6 @@ const executeCode = async (
{ typebot: { variables } }: LogicContext
) => {
if (!block.options.content) return
console.log('isEmbedded', isEmbedded)
if (block.options.shouldExecuteInParentContext && isEmbedded) {
sendEventToParent({
codeToExecute: parseVariables(variables)(block.options.content),