JoHa
JoHa

Reputation: 2039

Chat message from Graph API?

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?

Upvotes: 3

Views: 4644

Answers (3)

Can Bayburt
Can Bayburt

Reputation: 120

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.

Upvotes: 0

Flask
Flask

Reputation: 4996

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

Upvotes: 0

Anomie
Anomie

Reputation: 94844

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.

Upvotes: 1

Related Questions