2
0

🔊 Add more error logs for sendEmail block

This commit is contained in:
Baptiste Arnaud
2023-03-16 12:28:24 +01:00
parent cd09f1075f
commit 3d8cb40f06
6 changed files with 45 additions and 24 deletions

View File

@ -17,6 +17,7 @@ import { decrypt } from '@typebot.io/lib/api/encryption'
import { saveErrorLog } from '@/features/logs/saveErrorLog'
import { updateVariables } from '@/features/variables/updateVariables'
import { parseVariables } from '@/features/variables/parseVariables'
import { saveSuccessLog } from '@/features/logs/saveSuccessLog'
export const createChatCompletionOpenAI = async (
state: SessionState,
@ -89,6 +90,11 @@ export const createChatCompletionOpenAI = async (
}, [])
if (newVariables.length > 0)
newSessionState = await updateVariables(newSessionState)(newVariables)
state.result &&
(await saveSuccessLog({
resultId: state.result.id,
message: 'OpenAI block successfully executed',
}))
return {
outgoingEdgeId,
newSessionState,

View File

@ -37,23 +37,35 @@ export const executeSendEmailBlock = async (
},
],
}
await sendEmail({
typebotId: typebot.id,
result,
credentialsId: options.credentialsId,
recipients: options.recipients.map(parseVariables(variables)),
subject: parseVariables(variables)(options.subject ?? ''),
body: parseVariables(variables)(options.body ?? ''),
cc: (options.cc ?? []).map(parseVariables(variables)),
bcc: (options.bcc ?? []).map(parseVariables(variables)),
replyTo: options.replyTo
? parseVariables(variables)(options.replyTo)
: undefined,
fileUrls:
variables.find(byId(options.attachmentsVariableId))?.value ?? undefined,
isCustomBody: options.isCustomBody,
isBodyCode: options.isBodyCode,
})
try {
await sendEmail({
typebotId: typebot.id,
result,
credentialsId: options.credentialsId,
recipients: options.recipients.map(parseVariables(variables)),
subject: parseVariables(variables)(options.subject ?? ''),
body: parseVariables(variables)(options.body ?? ''),
cc: (options.cc ?? []).map(parseVariables(variables)),
bcc: (options.bcc ?? []).map(parseVariables(variables)),
replyTo: options.replyTo
? parseVariables(variables)(options.replyTo)
: undefined,
fileUrls:
variables.find(byId(options.attachmentsVariableId))?.value ?? undefined,
isCustomBody: options.isCustomBody,
isBodyCode: options.isBodyCode,
})
} catch (err) {
await saveErrorLog({
resultId: result.id,
message: 'Email not sent',
details: {
error: err,
},
})
}
return { outgoingEdgeId: block.outgoingEdgeId }
}

View File

@ -1,6 +1,6 @@
{
"name": "@typebot.io/wordpress",
"version": "3.1.4",
"version": "3.1.6",
"main": "index.js",
"repository": "https://github.com/baptisteArno/typebot.io",
"author": "baptisteArno",
@ -11,7 +11,7 @@
},
"scripts": {
"deploy": "pnpm copy && pnpm commit",
"copy": "svn copy ./trunk ./tags/3.1.4",
"commit": "svn ci -m 'Support for custom apiHost'"
"copy": "svn copy ./trunk ./tags/3.1.6",
"commit": "svn ci -m 'Fix default apiHost typo'"
}
}

View File

@ -5,7 +5,7 @@ Requires at least: 5.0
Tested up to: 6.0
License: GPL 2.0
License URI: http://www.gnu.org/licenses/gpl-2.0.txt
Stable Tag: 3.1.4
Stable Tag: 3.1.6
== Description ==
Collect 4x more responses with conversational apps using Typebot.
@ -24,6 +24,9 @@ This plugin relies on Typebot which is a tool that allows you to create conversa
3. Activate your Typebot with the "Typebot" admin button located in the sidebar
== Changelog ==
= 3.1.6 =
* Fix default apiHost typo
= 3.1.4 =
* Support for apiHost field in shortcode

View File

@ -80,7 +80,7 @@ class Typebot_Public
$lib_url = "https://cdn.jsdelivr.net/npm/@typebot.io/js@0.0/dist/web.js";
$width = '100%';
$height = '500px';
$api_host = 'https://api.typebot.io';
$api_host = 'https://viewer.typebot.io';
if (array_key_exists('width', $attributes)) {
$width = sanitize_text_field($attributes['width']);
}

View File

@ -3,7 +3,7 @@
/**
* Plugin Name: Typebot
* Description: Convert more with conversational forms
* Version: 3.1.4
* Version: 3.1.6
* Author: Typebot
* Author URI: http://typebot.io/
* License: GPL-2.0+
@ -16,7 +16,7 @@ if (!defined('WPINC')) {
die();
}
define('TYPEBOT_VERSION', '3.1.4');
define('TYPEBOT_VERSION', '3.1.6');
function activate_typebot()
{