如何使用sendy检查用户(已订阅或未订阅)的状态

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

本文关键字:状态 sendy 何使用 检查 用户      更新时间:2023-09-26

我使用sendyAPI,从代码中订阅用户。我正在使用javascript。我也关注过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获取用户状态时出错{[Error:[404 Error]如果您在安装后看到此错误,请查看此常见问题解答以获得修复:https://sendy.co/troubleshooting#404-错误][message]:'[404 error]如果您在安装后看到此错误,请查看此常见问题解答以获得修复:https://sendy.co/troubleshooting#404-错误'}在[2016年5月10日星期二12:55:30 GMT+0530(IST)]jobScheduler:error:performJob失败{[error:[404 error]如果您在安装后看到此错误,请查看此常见问题解答以获得修复:https://sendy.co/troubleshooting#404-错误][message]:'[404 error]如果您在安装后看到此错误,请查看此常见问题解答以获得修复:https://sendy.co/troubleshooting#404-错误'}在〔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.
   });