With variables you can optionally pass custom context variables to the bot when initiating a bot session. See What’s a Variable?. Let’s say you want the bot to greet the customer with their name. First, configure a CustomerName context variable in the Bot Builder.

Then create a variables list and add the context variable with the value. Include this in the initial BotSendMessageRequest() object when you start the session.
List<AnyVariable> variables = Collections
.singletonList(new TextVariable()
.name("CustomerName") // Context variableName
.type(TypeEnum.TEXT)
.value("Jane Doe")// Context variableValue
);
BotSendMessageRequest botSendInitMessageRequest = BotRequest
.withMessage(message)
.variables(variables)
.requestId(UUID.randomUUID().toString())
.build();
You can then configure the greeting message to show the customer’s name. Here is the bot’s response message using the CustomerName context variable with the value “Jane Doe”.
Hi Jane Doe,
I’m a demo bot for the user guide.
Choose one of the options below
1.Order Status
2.Frequently Asked Questions
3.Transfer To Agent
4.End Chat