开发者

Chat message from Graph API?

开发者 https://www.devze.com 2023-02-28 21:19 出处:网络
开发者_C百科Are there any PHP examples of how to send Facebook chat messages to friends of the user, through Graph API? I want users to be able to invite their friends to my site through sending them

开发者_C百科Are there any PHP examples of how to send Facebook chat messages to friends of the user, through Graph API? I want users to be able to invite their friends to my site through sending them invite link, but this link should not be public.

I already have Graph API set up on my website, and I would like to send a chat message (i.e. an invitation link) using that authenticated user session. Is that possible?

If not, is there an alternative way to accomplish the same thing?


There is no way to send chat messages through the Graph API. Chat messages use the XMPP protocol. See the documentation for details.

There does not seem to be any way at this time to send a private message through the Graph API; messaging is currently read-only, and posts to another user's wall are visible to anyone who can see the victim's target user's wall.


maybe its possible since chat and inbox are the same: check https://developers.facebook.com/docs/reference/api/message/ therefor


Facebook's Chat API is deprecated since Graph API and they suggest no alternatives for now.

However, you have a limited alternative to send messages (only from a page) to a user (this only applies to conversations between your page and a user and you can only reply to user-initiated conversations):

  1. Using /{page-id}/conversations edge, get a list of conversations that currently exist for the page.
  2. Then, you can POST /{conversation-id}/messages with message field on the request body to send a reply to this conversation.

For details and limitations, see this Graph API reference page.

NOTE: The standard messages and inbox objects are read-only.

I'm sure there will be a new method for chat when they totally deprecate the old Chat API. They're working hard to deal with spam.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号