最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

按ID过滤消息需要授权

网站源码admin39浏览0评论

按ID过滤消息需要授权

按ID过滤消息需要授权

我正在尝试使用 sendgrid api 来根据 ID 过滤消息。我有以下代码:

try {
    client.setApiKey(process.env.SendGridKey);

    const request = {
      url: `/v3/messages/${req.params.mail_id}`,
      method: "GET",
    };

    await client
      .request(request)
      .then(([response, body]) => {
        context.res = {
          body,
        };
      })
      .catch((error) => {
        console.log(JSON.stringify(error));
      });
  } catch (error) {
    context.res = {
      status: 500,
    };
  }

我收到 400 错误提示:

[{"message":"authorization required"}]

API 密钥正确,正在使用中。我还有其他这样写的方法,它们似乎都运行良好。

这里可能是什么问题?我使用的代码与 sendgrid API 参考中的大部分相同。

回答如下:

嘿,确保您订阅了“扩展的电子邮件活动历史记录”插件。它使您可以访问到 api 端点:

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论