Skip to content

Commit 1f29b77

Browse files
Merge pull request #163 from w3nder/develop
Fix: Variables null
2 parents 28bd796 + 6a3f82e commit 1f29b77

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/whatsapp/services/typebot.service.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,11 @@ export class TypebotService {
114114
instanceName: instance.instanceName,
115115
};
116116

117-
variables.forEach((variable) => {
118-
prefilledVariables[variable.name] = variable.value;
119-
});
117+
if (variables?.length) {
118+
variables.forEach((variable: { name: string | number; value: string }) => {
119+
prefilledVariables[variable.name] = variable.value;
120+
});
121+
}
120122

121123
if (startSession) {
122124
const response = await this.createNewSession(instance, {

0 commit comments

Comments
 (0)