Facebook Send Dialog: Check if a user allows sending him private message - facebook-graph-api

Before sending private message to Facebook user X, how can I check if this user allows to send him messages ?
Any user can disable the ability of other users (which are not his friends) to send him private messages, by changing the privacy policy.

Related

Is it possible to send and fetch Facebook messages using Graph API for v4.0 or greater?

I want to create a web application using PHP which will allow to connect Facebook accounts with my application and once they authenticated my application can fetch inbox messages of that user and can auto reply to the messages received against authenticated Facebook accounts.
Also, allow user to send messages manually from my application to Facebook inbox.
Is this possible with Graph API or any other Facebook API which will allow me to do above mentioned things.
Some people was told that this feature is no longer available after Facebook Graph API v2.4.
and once they authenticated my application can fetch inbox messages of that user and can auto reply to the messages received against authenticated Facebook accounts.
Neither of those two things is possible.
You can not read the messages of user accounts any more, and you can not reply in their name either.
The only messaging that can be handled via API, is that between a user and a page.
Assuming you refer to Page conversations, not user conversation, see /conversations and /messages docs here:
https://developers.facebook.com/docs/graph-api/reference/page/conversations/
https://developers.facebook.com/docs/graph-api/reference/v5.0/conversation/messages

Facebook Graph API: how to send chat message to all members of a group

I am trying to get all members of a group and send them all a chat message (rather than a group post as the chat message 'pops' up for the users so they can see it easily.)
I am using the <group_id>/members API (https://developers.facebook.com/docs/workplace/integrations/custom-integrations/reference/group) edge to return the members ID and Name but I am unable to use this ID in the me/messages SEND API (https://developers.facebook.com/docs/messenger-platform/send-messages). It looks like I need to get the users page-scoped ID but I do not know how to do that, or indeed if there are any other (better) approaches i could look at.
You can only send messages from Pages to Users, and only if they initiated the conversation (so they specifically authorized your Page to send them a message). There is no API to send messages from User to User or from Group to User, and of course there is no way to send messages to all members of a Group. That would be pure spam.

Alternative to pull events from Facebook Graph API

Looking for alternatives on how to use the events API since the Facebook changes.
https://developers.facebook.com/blog/post/2018/04/04/facebook-api-platform-product-changes/
Our app currently uses /search endpoint, pulling events based on a /location (miles radius). Is this totally revoked or is there a way to work around?
Thanks.
You can no longer use the /search endpoint with the following object types: event, group, page, user
Please read: https://developers.facebook.com/docs/graph-api/changelog/breaking-changes#search-4-4
Currently to access events you can use a user endpoint such as ‘/me/events’ or ‘/me/events/not-replied’ using an access token valid for that user. you can get the events that the user was invited to or is going/interested
You can access an event endpoint /{event-id} with an user access token if that user has been invited or is going/attending or is the creator of that event.
I believe its possible (but didn’t test it yet) to access to a specific page events endpoint, such as /{page_id}/events with a page access_token such as manage_pages, if Facebook already approved that permission and the page owner accepted the permission.

AWS Cognito verification email not received by user account

While creating user in userpool, user invitation messages are sent with a temporary password but email verification messages is not being sent.
I was creating a very simple setup to try out aws cognito service.
Here is what I did in AWS cognito, I created a user pool with step by step as follows:
1)What do you want to name your user pool?
-> testpool
2)How do you want to create your user pool?
-> step through settings
3)How do you want your end users to sign in?
->Email address or phone number-Allow email addresses
4)What password strength do you want to require?
->Minimum length=6
5)Do you want to allow users to sign themselves up?
->Allow users to sign themselves up
6)How quickly should user accounts created by administrators expire if not used?
->Days to expire-7
7)Do you want to enable Multi-Factor Authentication (MFA)?
->off
8)Do you want to require verification of emails or phone numbers?
->Email
9)You must provide a role to allow Amazon Cognito to send SMS messages
->testpool-SMS-Role
10)Do you want to customize your email verification messages?
->Verification type-link
->Email subject = Your verification link
->Email message = Please click the link below to verify your email address. {##Verify Email##}
11)Do you want to customize your user invitation messages?
->SMS message = Your username is {username} and temporary password is ->{####}.
->Email subject = Your temporary password
->Email message = Your username is {username} and temporary password is {####}.
12)Do you want to customize your email address?
->no
13)Do you want to add tags for this user pool?
->no
14)Do you want to remember your user's devices?
->no
15)Which app clients will have access to this user pool?
->none(will simulate from create user option in genral setting-user and group)
16)Do you want to customize workflows with triggers?
->no
17)Review page - this page shows summary of whatever I selected
Create pool
Now after pool creation went ot genral setting-user and group and clicked create user
A Create user pop-up shows:
Username (Required): myEmailAddress
Send an invitation to this new user?: check
Temporary password: left blank
Phone Number: empty(not required)
Mark phone number as verified? unCheck
Email: myEmailAddress
Mark email as verified? unCheck
Click on Create User
A mail is received into my account form no-reply#verificationemail.com via amazonses.com,with subject: Your temporary password with message as: Your username is somemailid#gmail.com and temporary password is agsjyk.
This is okay.
But I didnot receive any verification mail link before previous mail.
Not sure if you're missing this particular setup....Domain name is require for link verification.
Under "Tab integration" then "Domain name"
A mail is received into my account form no-reply#verificationemail.com via
amazonses.com,
with subject: Your temporary password
with message as: Your username is somemailid#gmail.com and temporary password is > agsjyk.
Looking at this it seems you are creating the user via the Cognito API by the AdminCreateUser method, and that's why you are receiving a temporary password.
The confirmation email you are expecting will only be sent if the user registers itself, so you should use the SignUp method.
verification mail link is for when users sign themselves up, they will receive a link to ask them to verify the email address instead of a code. In your case, you are send a temporary password to the user, so the link wont show up.
You need to add a domain in this section of the Incognito Service:
Also, if you are not getting the email, click on the user, and check their email, it could be wrong.
If anyone else is facing this issue, it appears that you cannot send verification emails if you use SAML or a federated identity provider. Cognito sets the cognito user to EXTERNAL_PROVIDER and no Cognito API calls allow sending a verifcation code or link. The cognito user is automatically created on initial sign-in. I have my user pool set to validate email address but it is always set to false.
The only way that I know to confirm the user via SSO is to use an external verification process outside of cognito.
With Cognito, if you have added both email and phone number then you should allow both as verification methods(In the SignUp experience Tab) as below:
Otherwise the email verification link or code is not sent

Django private messages notification

How this real time notification works? Something like notification in Facebook.
I have a webpage in Django. And user A send a message to User B. And this works in my project but user B see the message notification (You have a message) onlny when he refreshes the page.
How to do this in real time? User A send a message, user B has opened webpage and when message has been sent User B automaticaly see that he has new message (without refresh the page).
I can send a ajax request every second from client to server to 'ask' server that does client have a new message. But I think - this is not much efficient and there is a best way to do this.