2014-10-11 70 views
0

正如標題所述,我想發送兩個不同的電子郵件,同時發送給兩個不同的用戶。 我正在使用JavaScript作爲API。使用Customer.io如何同時向兩個不同的用戶同時發送2個不同的電子郵件。

我也想知道如何在自定義日期發送延遲電子郵件。目前我們可以通過儀表板完成這項工作,但可以修復日/星期。但我正在尋找的是計算日期並添加一個自定義日期延遲,不能按照儀表板中給定的那樣進行預定義。

謝謝。

回答

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--; 

    } 
} 
相關問題