使用Customer.io如何同时向两个不同的用户发送2个不同的电子邮件。

时间:2014-10-11 03:49:49

标签: javascript api email email-integration

正如标题所述,我想同时向两个不同的用户发送两封不同的电子邮件。 我正在使用JavaScript作为API。

我也想知道如何在自定义日期发送延迟的电子邮件。目前我们可以从仪表板中执行此操作,但这可以修复数天/周。但我正在寻找的是计算日期并添加一个无法预定义的自定义日期延迟,如仪表板中给出的那样。

谢谢。

1 个答案:

答案 0 :(得分:0)

问题已经解决了。 我为每个客户创建了两个单独的API调用。使用switch语句和while循环

switch(customer){
    while(counter > 0){
        case 1:
            //Make first API call  
           //_cio.identify
           _cio.identify({
               // Required attributes
               id: id,           // Unique id for the currently signed in user in your application.
               email: yourEmail, // Email of the currently signed in user.
               created_at: time,   // Timestamp in your system that represents when
                            // the user first signed up. You'll want to send it
                            // as seconds since the epoch.

  // Optional (these are examples. You can name attributes what you wish)

              task: task,
              supervisor_email: supervisorEmail,       // Add any attributes you'd like to use in the email subject or body.
              goal_date: date,      // To use the example segments, set this to 'free' or 'premium'.
             user_name: name,
             supervisor_name: supervisorName,
             goal_setter: isUser,
             pay: pay

         });

          customer = 2;
        break;

       case 2:
           //Make the second API call
           break;

      counter--;

    }
}