如何获得Alexa技能的用户日期/时间或时区信息? [英] How do I get a user's date/time or timezone information for an Alexa Skill?

查看:164
本文介绍了如何获得Alexa技能的用户日期/时间或时区信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Lambda(Python)开发技能,并且我有兴趣向用户提供一些与时间相关的信息。在请求对象上有一个时间戳,但这是没有偏移量的UTC。是否可以找到无需查询位置信息的用户的日期/时间或时区(如果那是唯一的方法,您是否知道美国邮政编码所在的时区数据库或其他解决方法?)。

I'm using Lambda (Python) to develop a skill and I'm interested in giving the user some time-related information. On the request object there is a timestamp but that is UTC without offset. Is there a way to find the user's date/time or timezone without having to ask for location information (and if that's the only way, do you know of a database of US zip codes to timezone or another workaround?).

推荐答案

现在可以使用 Alexa设置API 。请参阅相关的博客

It is now possible to get the user's timezone using the Alexa Settings API. See the related blogpost for official information about this feature's release.

您将感兴趣的端点如下:

The endpoint you'll be interested in is the following:

GET /v2/devices/{deviceId}/settings/System.timeZone

您只需要提供用户的设备ID,这是接收到的意图的一部分。该响应将包含一个时区名称,例如欧洲/伦敦。

You simply need to provide the user's device ID, which is part of the received intent. The response will contain a timezone name, for instance "Europe/London".

这篇关于如何获得Alexa技能的用户日期/时间或时区信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆