친구에게 비공개 메시지 보내기
Facebook을 통해 사용자 정보를 연결하고 모든 친구에게 비공개 메시지를 보내야합니다. 가능할까요?
이제 API를 통해 개인 메시지를 보낼 수 있습니다.
메시지 전송을 위해이 이벤트를 발생시킵니다 (페이스 북 개체의 초기화는 이전에 완료되어야합니다).
to:user
페이스 북 아이디
function facebook_send_message(to) {
FB.ui({
app_id:'xxxxxxxx',
method: 'send',
name: "sdfds jj jjjsdj j j ",
link: 'https://apps.facebook.com/xxxxxxxaxsa',
to:to,
description:'sdf sdf sfddsfdd s d fsf s '
});
}
속성
app_id
애플리케이션의 식별자입니다. 필수이지만 대부분의 SDK에서 자동으로 지정합니다.redirect_uri
사용자가 대화 상자에서 보내기 또는 취소 단추를 클릭 한 후 리디렉션 할 URL입니다. 필수이지만 대부분의 SDK에서 자동으로 지정합니다.display
대화 상자를 렌더링 할 표시 모드입니다. 이는 대부분의 SDK에서 자동으로 지정됩니다.to
메시지를 보낼 사용자 ID 또는 사용자 이름입니다. 대화 상자가 나타나면 사용자는 메시지를 보낼 추가 사용자, Facebook 그룹 및 이메일 주소를 지정할 수 있습니다. Facebook 그룹에 콘텐츠를 보내면 그룹의 담벼락에 게시됩니다.링크
(필수) 메시지에서 보낼 링크입니다.picture
기본적으로 지정된 링크에서 사진을 가져옵니다. 메시지에 포함 할 사진의 URL입니다. 링크 옆에 사진이 표시됩니다.이름 기본적으로 지정된 링크에서 제목을 가져옵니다. 링크의 이름, 즉 사용자가 클릭 할 텍스트를 표시합니다.
설명
기본적으로 설명은 지정된 링크에서 가져옵니다. 링크 아래에 표시 할 설명 텍스트입니다.
여기에서 더보기
@VishwaKumar :
맞춤 텍스트로 메시지를 보내려면에 'message'매개 변수를 추가해야 FB.ui
하지만이 기능은 더 이상 사용되지 않는 것 같습니다. 더 이상 메시지를 미리 채울 수 없습니다. 한 번 시도하지만.
FB.ui({
method: 'send',
to: '1234',
message: 'A request especially for one person.',
data: 'tracking information for the user'
});
이 링크를 참조하십시오 : http://fbdevwiki.com/wiki/FB.ui
아니요, 불가능합니다. Facebook 사용자에게 모든 종류의 메시지를 보내려면 해당 사용자의 승인이 필요합니다.
누군가 Facebook Connect를 사용하여 귀하의 사이트에 로그인하면 Facebook 데이터를 귀하의 사이트와 공유하는 데 명시 적으로 동의하는 것이며, 그러면 해당 사용자에게 일반 채널을 통해 메시지 를 보낼 수 있습니다 . 친구 목록을 가져올 수도 있습니다. 그러나 친구에게 메시지를 보낼 수는 없습니다.
지금은 불가능하지만 해결 방법이 있습니다. 공개 영역에서 사용자와 소통하고 비공개 메시지를 보내달라고 요청할 수 있지만 비공개 메시지는 다시 보낼 수 없으며 공개 메시지 만 보낼 수 있습니다. 물론 이것은 사용자가 올바른 권한을 제공하는지 여부에 달려 있습니다.
개인의 친구에 액세스 할 수있는 권한을 부여한 경우 이론적으로 각 친구에 대한 참조와 함께 해당 사용자 벽에 게시하여 공개적으로 상호 작용 한 다음 잠재적으로 비공개로 메시지를 보낼 수 있습니다.
친구 사귀기
#if authenticated
https://graph.facebook.com/me/friends
http://developers.facebook.com/docs/reference/api/user/
공개 도메인에 게시
http://developers.facebook.com/docs/reference/api/status/
해당 사용자에게 전송 된 메시지 가져 오기 (권한이있는 경우)
http://developers.facebook.com/docs/reference/api/message/
Facebook Chat API를 사용하여 비공개 메시지를 보낼 수 있습니다. 다음은 xmpp4r_facebook
gem을 사용하는 Ruby의 예입니다 .
sender_chat_id = "-#{sender_uid}@chat.facebook.com"
receiver_chat_id = "-#{receiver_uid}@chat.facebook.com"
message_body = "message body"
message_subject = "message subject"
jabber_message = Jabber::Message.new(receiver_chat_id, message_body)
jabber_message.subject = message_subject
client = Jabber::Client.new(Jabber::JID.new(sender_chat_id))
client.connect
client.auth_sasl(Jabber::SASL::XFacebookPlatform.new(client,
ENV.fetch('FACEBOOK_APP_ID'), facebook_auth.token,
ENV.fetch('FACEBOOK_APP_SECRET')), nil)
client.send(jabber_message)
client.close
좋은 방법은 아니지만 한 가지 해결 방법은 새 @ facebook.com 이메일 주소를 사용하는 것입니다. 여기에는 몇 가지 단점이 있습니다.
1) Not everyone (as of this posting) has the new messages application enabled in their account.
2) Not everyone will have setup their @facebook.com email in their messages app.
3) Not everyone will choose their username (if they even have a facebook username) as their email address.
You cannot. Facebook API has read_mailbox but no write_mailbox extended permission. I'm guessing this is done to prevent spammy apps from flooding friend's inboxes.
For mobile application i did a solution by injecting javascript in the dialog view. There is a hidden web view in my ios app. That load the fb message send dialog api .. then i inject some javascript to set the "to" and "message" field and submit the form.. So that end user need not to do anything. Message sent to facebook inbox silently...
There isn't any graph api for this, you need to use facebook xmpp chat api to send the message, good news is: I have made a php class which is too easy to use,call a function and message will be sent, its open source, check it out: facebook message api php the description says its a closed source but the it was made open source later, see the first comment, you can clone from github. It's a open source now.
This thread says you can't do send private messages to a group of friends on facebook but I found this https://developers.facebook.com/docs/sharing/reference/send-dialog
참고URL : https://stackoverflow.com/questions/2574431/send-private-messages-to-friends
'developer tip' 카테고리의 다른 글
OVER_QUERY_LIMIT 응답을받지 않고 20 개 주소를 지오 코딩하려면 어떻게해야합니까? (0) | 2020.09.10 |
---|---|
f : viewAction / preRenderView 대 PostConstruct를 언제 사용합니까? (0) | 2020.09.10 |
Akka 또는 원자로 (0) | 2020.09.10 |
AMI 저장 비용 (0) | 2020.09.10 |
PostgreSQL : CREATE TABLE 정의에서 인덱스를 생성 할 수 있습니까? (0) | 2020.09.10 |