如何从Google Chrome扩展程序发送Twitter直接消息?

时间:2013-07-29 14:01:25

标签: javascript jquery google-chrome-extension twitter

我想从Google Chrome扩展程序的后台页面发送直接消息。

我阅读了Twitter文档,但似乎没有一个简单的解决方案。

之前有人这样做过吗?到目前为止,我已尝试使用此API https://dev.twitter.com/docs/api/1.1/post/direct_messages/new使用AJAX调用发送消息我有错误400.

$.ajax({
  type: "POST",
  url: "https://api.twitter.com/1.1/direct_messages/new.json",
  data: {'text': 'Hello World', 'screen_name':'John'}
}).done(function( res) {
    console.log(res);
});

1 个答案:

答案 0 :(得分:1)

Twitter REST API v1.1需要身份验证

您可以使用

列出的有用库here

this is a really useful Twitter proxy script,只需将令牌和访问密钥替换为应用程序的密钥和访问密钥,并将所有请求路由到它 - 但是我没有将此用于POST请求

相关问题