gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:41:34 24 4
gpt4 key购买 nike

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

关于javascript - 如何使用 sendy 检查用户状态(订阅与否),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37132066/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com