1

My bot asks for a user's birthday which is returned as a timex. It's not clear that there are any functions in Composer to convert this to a datetime.

So, after asking for a date, the bot returns a timex into user.dob

[{
"value": "1989-02-01",
"timex": "1989-02-01"
}]

I've tried using the getProperty built-in function as in:

@{getProperty(user.dob,'value')}

but this returns as null. Likewise using 'timex'. Any suggestions?

0

2 Answers 2

1

Because it's a json array with one item. So you access the components:

user.dob[0].timex

user.dob[0].value

0

There's a separate library from Microsoft for doing just this: Microsoft.Recognizers.Text. This link is to the github project, which provides links to the DotNet and Node versions.

The problem is you're using Composer though, and I'm not sure this is integrated into their (at least not yet). In the meantime, perhaps you could write a custom Azure Function or similar, and call it via Composer Http Request

1
  • Thanks. Yes, I've used that library in other bots. But this seems like it should be straightforward so I'm thinking there is something that I am missing conceptually about how Composer handles/accesses data.
    – Dino
    Commented Jan 25, 2020 at 19:20

Not the answer you're looking for? Browse other questions tagged or ask your own question.