使用 linkedin gem 发送邀请

发布于 2024-11-05 07:59:22 字数 38 浏览 0 评论 0原文

我可以使用 linkedin gem 通过电子邮件发送邀请吗?

Can I use linkedin gem to send invitation by email??

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

走走停停 2024-11-12 07:59:22

看起来你还不能。来自自述文件:

待办事项

更改为 json api

更新并修正测试套件

更改为法拉第进行身份验证

实施消息 API

looks like you can not, yet. From the Readme:

TODO

Change to json api

Update and correct test suite

Change to Faraday for authentication

Implement Messaging APIs

单挑你×的.吻 2024-11-12 07:59:22

config/initializers/linkedin.rb

LinkedIn::Client.class_eval do
  def send_invitation(options)
    path = "/people/~/mailbox"
    message = {
      "recipients" => {
        "values" => [
          {
            "person" => {
              "_path" => "/people/email=#{options[:email]}",
              "first-name" => options[:first_name],
              "last-name" => options[:last_name]
            }
          }]
      },
      "subject" => "Invitation to connect.",
      "body" => options[:body],
      "item-content" => {
        "invitation-request" => {
          "connect-type" => "friend"
        }
      }
    }
    post(path, message.to_json, "Content-Type" => "application/json")
  end
end

像任何其他 gem 方法一样使用

client.send_invitation({:email=>"email", :first_name=>"first name", :last_name=>"last name", :body=>"body"})

config/initializers/linkedin.rb

LinkedIn::Client.class_eval do
  def send_invitation(options)
    path = "/people/~/mailbox"
    message = {
      "recipients" => {
        "values" => [
          {
            "person" => {
              "_path" => "/people/email=#{options[:email]}",
              "first-name" => options[:first_name],
              "last-name" => options[:last_name]
            }
          }]
      },
      "subject" => "Invitation to connect.",
      "body" => options[:body],
      "item-content" => {
        "invitation-request" => {
          "connect-type" => "friend"
        }
      }
    }
    post(path, message.to_json, "Content-Type" => "application/json")
  end
end

use like any other gem methods

client.send_invitation({:email=>"email", :first_name=>"first name", :last_name=>"last name", :body=>"body"})
一个人的旅程 2024-11-12 07:59:22
LinkedIn::Client.class_eval do
  def send_invitation(options)
    path = "/people/~/mailbox"
    message = {
      "recipients" => {
        "values" => [
          {
            "person" => {
              "_path" => "/people/#{options[:id]}",
              "first-name" => options[:first_name],
              "last-name" => options[:last_name]
            }
          }]
      },
      "subject" => "Invitation to connect.",
      "body" => options[:body],
      "item-content" => {
        "invitation-request" => {
          "connect-type" => "friend",
          "authorization" => {:"name" => 'NAME_SEARCH',:"value" => 'Mjwh'}
        }
      }
    }
    post(path, MultiJson.dump(message), "Content-Type" => "application/json")
  end
end

邀请人应添加"authorization" =>; {:“名称”=> 'NAME_SEARCH',:"值" =>来自搜索人员的 'Mjwh'}

client.search(:fields => [{ :people => %w(id 名字 姓氏 api-standard-profile-request)} ],:'first-name' => params["first_name"])

LinkedIn::Client.class_eval do
  def send_invitation(options)
    path = "/people/~/mailbox"
    message = {
      "recipients" => {
        "values" => [
          {
            "person" => {
              "_path" => "/people/#{options[:id]}",
              "first-name" => options[:first_name],
              "last-name" => options[:last_name]
            }
          }]
      },
      "subject" => "Invitation to connect.",
      "body" => options[:body],
      "item-content" => {
        "invitation-request" => {
          "connect-type" => "friend",
          "authorization" => {:"name" => 'NAME_SEARCH',:"value" => 'Mjwh'}
        }
      }
    }
    post(path, MultiJson.dump(message), "Content-Type" => "application/json")
  end
end

invite people should be add "authorization" => {:"name" => 'NAME_SEARCH',:"value" => 'Mjwh'} from the searched people

client.search(:fields => [{ :people => %w(id first-name last-name api-standard-profile-request)}],:'first-name' => params["first_name"])

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文