CustomerIO 我可以在每个 API 请求中指定 SMS 文本吗?

CustomerIO Can I specify SMS text in each API request?

我在 Rails 项目中使用 CustomerIO,需要向能够指定文本正文的用户发送 SMS 的功能。

如何指定要发送给 CustomerIO 的 SMS 文本?在docs, I could only find how to set a Campaign with pre-defined text body and some Liquid sugar.

阅读有关使用 Liquid 模板语言的文档,您走在正确的道路上。假设您已使用 Twilio 集成配置您的 Customer.io 帐户以发送 SMS 消息,那么只需创建一个带有 SMS 消息操作的活动即可,该活动可以从您通过 [=29] 发送的数据中提取您的自定义文本=].

本质上,如果您使用的是官方 customerio-ruby gem,您需要在事件中发送您希望在消息正文中使用的数据。像这样:

# Arguments
# customer_id (required) - the id of the customer who you want to associate with the event.
# name (required)        - the name of the event you want to track.
# attributes (optional)  - any related information you'd like to attach to this
#                          event.

$customerio.track(5, "sendsms", :msg => "This is the custom message body")

因此,在 Customer.io 中,您的事件触发的活动应该在每次收到名为 sendsms 的事件时触发,您可以为 SMS 操作的内容设置此设置:

{{ event.msg }}

这样,每次向 API 发送事件时,此活动都会针对发送事件的用户 ID 以及在 msg 属性 中传递的任何数据触发API 调用将通过 {{ event.msg }} Liquid 标签呈现。

这只是从 API 发送带有动态数据的 SMS 消息的一种方法,主要是一对一操作,因为您需要为每个用户 ID 发送一个 API 调用你想留言。还有其他机制,例如,如果您想进行一对多消息传递,其中单个 API 调用会触发许多 SMS 消息发送给您想要查看的许多用户 API Triggered Broadcast campaigns相反。