按钮触发器令牌入门Get started with button trigger tokens

什么是按钮触发器令牌?What are button trigger tokens?

按钮触发器令牌是允许在其上运行按钮流的设备知道并可供其使用的数据点。Button trigger tokens are data points that are known and available to the device on which a button flow is running. 这些令牌会根据多种因素(例如当前时间或者设备在给定时刻的地理位置)而变化。These tokens change based on factors such as the current time or the geographic location of the device at a given moment.

例如,如果用户在智能手机上运行按钮流,则该手机可能会知道当前位置的时间以及日期和当前地址。For example, if you are running a button flow on a smart phone, it is likely that the phone knows the time at your current location as well as the date and your current address. 在这种情况下,时间、日期以及手机所在的地址都是在按钮流运行时确定的。In this context, the time, date and address where the phone is located are all determined at the time the button flow runs. 这些数据自动供在设备上执行的任何按钮流使用。They are automatically available for use in any button flows that are executed on the device. 用户可以使用这些触发器令牌生成有用的流,以便尽量减少那些重复性任务,例如将地址提供给某人,或者跟踪在特定作业/服务调用上花费的时间。You can use these trigger tokens to build useful flows that will minimize repetitive tasks such as providing your location to someone or tracking how much time you spent on a particular job/service call.

按钮触发器令牌列表List of button trigger tokens

下面是按钮触发器令牌的列表,这些令牌可以在创建按钮流时使用。Here's the list of the button trigger tokens that are available for you to use when creating your button flows.

参数Parameter 说明Description
城市City 正在运行流的设备所在的城市。The city in which the device that's running the flow is located.
国家/地区Country/Region 正在运行流的设备所在的国家/地区。The country/region in which the device that's running the flow is located.
完整地址Full address 正在运行流的设备所在位置的完整地址。The full address where the device that's running the flow is located.
纬度Latitude 正在运行流的设备所在位置的维度。The latitude in which the device that's running the flow is located.
经度Longitude 正在运行流的设备所在位置的经度。The longitude in which the device that's running the flow is located.
邮政编码PostalCode 正在运行流的设备所在位置的邮政编码。The postal code in which the device that's running the flow is located.
省/自治区/直辖市State 正在运行流的设备所在的省/自治区/直辖市。The state in which the device that's running the flow is located.
街道Street 正在运行流的设备所在的街道。The street on which the device that's running the flow is located.
时间戳Timestamp 正在运行流的设备所在区域的时间。The time in the area where the device that's running the flow is located.
日期Date 正在运行流的设备所在区域的日期。The date in the area where the device that's running the flow is located.
用户名User name 用户登录到正在运行流的设备时所使用的用户名。The user name of the person signed into the device that's running the flow.
用户电子邮件User email 用户登录到正在运行流的设备时所使用的电子邮件地址。The email address of the person signed into the device that's running the flow.

创建使用触发器令牌的按钮流Create a button flow that uses trigger tokens

创建按钮时,可使用触发器令牌向按钮添加各种功能。When you create a button, you can use trigger tokens to add rich functionality to your button.

本演练将在 Android 设备上创建一个按钮流。In this walk-through, we will create a button flow on an Android device. 该按钮流会使用触发器令牌通过“在家工作”电子邮件将日期和你的完整地址发送给你的老板。The button flow will use trigger tokens to send the date and your full address in a "Working from home" email to your boss.

本演练显示的是 Android 设备的屏幕截图,但在 iOS 和 Windows Phone 设备上的体验是类似的。In this walk-through, you will see screen-shots from an Android device, however, the experience is similar on iOS and Windows Phone devices as well.

先决条件Prerequisites

开始操作:Let's get started:

  1. 启动 Flow 并选择“浏览” Launch Flow and select Browse
    按钮触发器令牌button trigger token
  2. 在“按钮”类别下选择“向经理发送‘今天在家工作’电子邮件”服务Select the Send a 'Working from home today' email to your manager service under the Button category
    按钮触发器令牌button trigger token
  3. 选择“使用此模板”Select USE THIS TEMPLATE
    按钮触发器令牌button trigger token
  4. 在“发送电子邮件”卡上选择“编辑”Select Edit on the Send an email card
    按钮触发器令牌button trigger token
  5. 点击“主题”文本框,然后将“今天 - ”输入文本框中,位于“WFH”文本之后。Tap the Subject text box and enter: " today - " into the text box after the "WFH" text. 请注意,在点击文本框时,也打开了一个参数/令牌的列表。Notice that when you tapped on the text box, a list of parameters/tokens also opened up. 我们会在下一步使用其中一个令牌将日期添加到电子邮件主题中。We'll use one of these tokens in the next step to add the date to the subject of the email.
    按钮触发器令牌button trigger token
  6. 光标仍在主题文本框中,此时可滚动到参数的“手动”列表,然后点击“日期”。With the cursor still in the subject text box, scroll to the manual list of parameters and tap Date. 请注意,此时日期参数位于“主题”文本框中:Notice the date parameter is now in the Subject text box:
    按钮触发器令牌button trigger token
  7. 滚动到“正文”文本框,在默认消息后点击,以便在其中添加其他令牌。Scroll to the Body text box and tap after the default message so that additional tokens can be included there.
    按钮触发器令牌button trigger token
  8. 点击“完整地址”参数,然后点击“创建”Tap the Full address parameter, then tap Create
    按钮触发器令牌button trigger token
  9. 点击“完成”。Tap Done. 按钮流现在已创建。Your button flow is now created.
    按钮触发器令牌button trigger token

运行按钮流Run the button flow

注意:此按钮流会通过电子邮件发送你的当前位置。NOTE: This button flow will send your current location via email.

  1. 点击屏幕底部的“按钮”类别。Tap the Buttons category at the bottom of the screen. 此时会显示用户有权使用的按钮的列表。You will see a list of the buttons that you have permissions to use. 点击代表刚创建的按钮流的那个按钮:Tap the button that represents the button flow you just created:
    按钮触发器令牌button trigger token
  2. 点击“允许”,允许按钮流访问设备的位置信息:Tap ALLOW to indicate that it's OK for the button flow to access your device's location information:
    按钮触发器令牌button trigger token
  3. 你会注意到,电子邮件很快就发送给了你的老板:Within a few moments, notice that the email was sent to your boss:
    按钮触发器令牌

恭喜!你刚创建了一个使用日期和完整地址触发器令牌的按钮流。Congratulations, you've just created a button flow that uses both the date and full address trigger tokens.

后续步骤Next steps