【问题标题】:How can I capture Direct Message via Instagram API?如何通过 Instagram API 捕获直接消息?
【发布时间】:2016-06-22 03:04:11
【问题描述】:

我搜索了 api instagram 是否有任何方法可以返回直接消息,但一无所获。你能告诉我有没有什么,或者不可能吗? Instagram 不提供?或者我可以以编程方式进行? 我需要捕获直接消息,可以吗?

【问题讨论】:

标签: instagram


【解决方案1】:

没有用于直接消息的 Instagram API,而且现在已经快 4 年了,我想应该不会有。您或许可以使用 Instagram node.js Private API 库或 Instagram PHP Private API 库

不过,我必须警告您,我确实尝试使用 PHP 库,而 Instagram 不允许发送直接消息,无论我尝试了多少黑客手段让它发挥作用。但也许这只是我......

如果你能够使用 node.js,似乎 Thread.configureText 可以用于在 node.js 库上发送直接消息。

【讨论】:

  • This PHP 库可以通过 Instagram Private API 发送直接消息,它对我有用
【解决方案2】:
string status_DM = string.Empty;
string Url_DirectMessage = "https://i.instagram.com/api/v1/direct_v2/threads/broadcast/text/";
string guid = obj_InstaUser.guid;
string userID = string.Empty;  // put user id to whom you want to send message

string responce = obj_new.getHtmlfromUrl(new Uri("https://www.instagram.com/" + username));

if(string.IsNullOrEmpty(userID))
{
    userID = Utils.getBetween(responce, "profilePage_", "}").Replace(" ","").Replace("\"","");
}
try
{
    string postData = "recipient_users=%5B%5B%22" + userID + "%22%5D%5D&client_context=%22" + guid + "%22&text=" + text + "&thread_ids=%5B%220%22%5D";
    try
    {
        string  Finalresult = obj_InstaUser.globusHttpHelperMobile.postFormDataMobileLogin_Directmessage(new Uri(Url_DirectMessage), postData);

        status_DM = "Success";
    }
    catch (Exception ex)
    {

        status_DM = "Fail";
    }
}
catch(Exception ex)
{

}

【讨论】:

  • 我将在哪里获得 globusHttpHelperMobile.postFormDataMobileLogin_Directmessage ?
【解决方案3】:

您现在可以使用instagram-messager-api。 您打算接收其 DM 的页面必须有 1k-100k 关注者。

【讨论】:

    【解决方案4】:

    自 2021 年 8 月 16 日起,您可以通过官方 API 发送和接收 IG 消息。

    以下是官方“FACEBOOK for developer”网站的引述: “自 2021 年 8 月 16 日起,所有 Instagram 企业帐户都可以连接到 Messenger API for Instagram。” (Instagram Messaging)

    【讨论】:

      【解决方案5】:

      使用 Instagram 私有 API。通过这个,您可以发送直接消息。 我在 C# 中做过,效果很好。 (也可以直接留言和上传帖子。)

      【讨论】:

      • 能否提供c#项目的github链接?
      • 这里也一样! @jolta
      猜你喜欢
      • 1970-01-01
      • 2015-05-19
      • 2015-06-07
      • 2016-04-05
      • 1970-01-01
      • 2017-12-05
      • 1970-01-01
      • 2018-02-18
      • 1970-01-01
      相关资源
      最近更新 更多