Create setVariable prototype interaction via API

I am trying to set up a Set Variable prototype connection with the API but when I copy the data structure for an actual “SET_VARIABLE” prototype reaction I get this error.

This is the connection I am setting up:

	let getVariableReaction = (newChar, varId) => {

		let newReaction = {
			type: "SET_VARIABLE",
			variableId: varId,
			variableValue: {
				resolvedType: "STRING",
				type: "EXPRESSION",
				value: {
					resolvedType: "STRING", // <-- this fixed my issue
					type: "EXPRESSION",
					value: {
						expressionArguments: [
							{
								resolvedType: "STRING",
								type: "VARIABLE_ALIAS",
								value: {
									id: varId,
									type: "VARIABLE_ALIAS"
								}
							},
							{
								resolvedType: "STRING",
								type: "STRING",
								value: newChar
							}
						],
						expressionFunction: "ADDITION"
					}
				}
			}
		}

		return newReaction;
	}

Am I missing something?? I copied it directly from what I see in Figma when I set the same interaction up in the UI.

This is what I’m copying from Figma when I look at a set variable interaction done in the UI.


SOLVED. Human error!

Needed to add resolvedType: 'STRING' in variableValue.value

SOLVED.

Just needed to add resolvedType: 'STRING' to `variableValue.value

1 Like

Following up here, we just released official documentation and typings for advanced prototyping functionality in the plugin API: Version 1, Update 77 | Plugin API

1 Like