如何使用 sendy 检查用户状态(订阅与否)

How to check status of the user (subscribed or not) using sendy

我正在使用 sendy-api, to do subscribe for user from the code. I am using javascript. Also I have followed sendy-github .

我想在订阅之前检查用户的状态。如果用户已经取消订阅,我不想再次订阅。给出我试过的代码。

var Sendy = require('sendy-api'),
    sendy = new Sendy('http://your_sendy_installation'),
    
    sendyStatus = new Sendy('http://your_sendy_installation/api/subscribers/subscription-status.php'); //There is something wrong in this part I think

var eachUser = {em : 'abcd@xyz.com'};

 sendyStatus.status({email: eachUser.em, list_id: 'someListID'}, function(err, userInfo)                       
   {
      console.log(userInfo)
   });

得到如下错误:-

从 sendy 获取用户状态时出错{ [错误:[404 错误] 如果您在安装后看到此错误,请查看此常见问题解答以获得修复:https://sendy.co/troubleshooting#404-error] [message]: '[404 error] If you\'re seeing this error after install, check this FAQ for the fix: https://sendy.co/troubleshooting#404-error' } at [Tue May 10 2016 12:55:30 GMT+0530 (IST)] jobScheduler:error:performJob 失败{ [错误:[404 错误] 如果您在安装后看到此错误,请查看此常见问题解答以获得修复:https://sendy.co/troubleshooting#404-error] [message]: '[404 error] If you\'re seeing this error after install, check this FAQ for the fix: https://sendy.co/troubleshooting#404-error' } 在 [2016 年 5 月 10 日星期二 12:55:30 GMT+0530 (IST)]

有人知道如何解决这个问题吗?我做错了什么吗?

我忘记添加 'api-key' 所以我得到了错误,因为它写在 github 中。

现在代码如下,并且可以正常工作:-

var Sendy = require('sendy-api'),
    sendy = new Sendy('http://your_sendy_installation', 'api-key'); // Without api key it won't work.
   

var eachUser = {em : 'abcd@xyz.com'};

 sendy.status({email: eachUser.em, list_id: 'someListID'}, function(err, userInfo)                       
   {
      console.log(userInfo) // will give status of the user.
   });