mpjjonker
mpjjonker

Reputation: 947

Providing the $timezone context variable does not change now() behavior in Watson Assistant

We want to work with timezones in the Watson Assistant responses. Basically we want to implement the "good morning" sample as described here: https://console.bluemix.net/docs/services/conversation/dialog-methods.html#date-time

When we post to this URL

https://gateway.watsonplatform.net/assistant/api/v1/workspaces/<workspaceid>/message?version=2018-02-16

using this payload (first call in the conversation)

{"context":{"$timezone":"Europe/Amsterdam"}}

We keep getting greetings based on the UTC. When we add the now() output to the response we also do see the time according to the UTC.

The strange thing is, when we try this out in the try-out panel of the Watson Assistance workbench (browser) the output behaves as expected ?

Upvotes: 1

Views: 903

Answers (1)

data_henrik
data_henrik

Reputation: 17176

The value should be, without the dollar sign:

{"context":{"timezone":"Europe/Amsterdam"}}

The $ is used to denote (context) variables for the short syntax, but in the payload you are working with the regular context struture and key/value pairs.

Upvotes: 2

Related Questions