how to delete a message - facebook-graph-api

I try to delete a message from my inbox.
But i get 100 invailid parameter exception
I use csharp sdk
FacebookWebClient fbw = new FacebookWebClient(accesstoken);
fbw.Delete("/userid_messageid");

There's no way to delete inbox messages with current API's. Permission about inbox is read-only.

Did your app create that message in the first place? If not, then you cannot delete it.

Related

What would be a good way to initialize a subscription for pubsub

I am trying to use pubsub for the first time outside of cloud functions in a cloud run service, and I am confused about the use of createSubscription.
I trigger the message from a job in cloud scheduler, and when I set the topic it creates the topic in the project for me if it doesn't exist yet.
Now the cloud run service, when it starts, could call createSubscription, because initially there is no subscription yet. But it seems that createSubscription should only be called once (like createTopic) because after that I get an error saying a subscription with that name already exists.
I could place a try/catch around createSubscription and ignore the error on subsequent service deployments, but that seems a bit odd.
What would be a good way to initialize the subscription?
This is what we do in production - we have a try-catch block, so if the sub is already there, we ignore the exception. Make sure to also check the filters if necessary. They might change (if you change them programmatically, in this case you need to recreate the subscription)
TopicName topic = TopicName.ofProjectTopicName(projectId, this.topic);
try {
client.createSubscription("projects/xxx/subscriptions/" + subscriptionId, topic, PushConfig.getDefaultInstance(), 600);
} catch (AlreadyExistsException e) {
// sub is already there. nothing to do
}

GMAIL API - get message by historyID

I'm using users.watch method to get event when new e-mail message had received, using topic pub/sub. It works fine, but, such explained in this link, the event received in responde body is historyId, but I wish get new message sent in e-mail. How I get new message using historyId? Get first element using users.messages.list with maxResults = 1 not sounds good for me, because in the short time between activated event and users.messages.list execute, if another new message arrives, the previous one will be lost because messages.list get the most recent message. How to convert historyId to messageId, and so finally use users.messages.get ?

How can I know whether user clicked on notification or not?

my tried wayI am trying to know when i am sending push notification to users they will open the notification or not. i am able to get the number of sent notification or number of successful and failed notification but i am unable to get the user response record.I am using aws sns push notification with fcm
it's easy!
Just put a little code in notification code, when user clicked the notification it gets the value from the database which is 0 when you start sending the notification, and add +1 in it and again store that value in the database.
This is the simple way you can check how many people open your notification.
Regards,
Sameer Rehman

Unable send a message with stompclient

Iam trying to send a message to activemq using pythons stompclient.
https://bitbucket.org/hozn/stompclient/wiki/User%20Documentation
If there is a better library for this Im open to suggestions.
If i change to ip or port it will fail to connect so im assuming that the connection is working. There are no errors when I run this code its just that I see no messages on the queue. I think the destination path is possibly where it is failing the PhysicalName of the activemq queue is in this pattern 'abc.queue_name'.
I've tried the following destinations
/queue/abc/queue_name
/queue/abc.queue_name
abc.queue_name
Any suggestions are greatly appreciated.
Thanks
from stompclient import PublishClient
client = PublishClient('IP', 53680)
response = client.connect('defaultPassword', 'defaultUser')
reponse1 = client.send('/queue/abc/queue_name', 'bla')
time.sleep(5)
Have you checked the webconsole to see if your Queue was created by the send?
You should also try adding a request id onto the send and waiting for a response, this will ensure that the broker has enough time to get the sent data before you client code disconnects.
You might also want to check the Broker logs to see if any errors are logged or any security warnings in case the user doesn't have publish rights.
Added this property to the activemq.xml file and im now seeing messages on the queue via the web console.
<transportConnector name="stomp" uri="stomp://0.0.0.0:61613"/>

Graph API Calls Fail Only for Notifications

Using this Graph API call:
https://developers.facebook.com/tools/explorer/?method=GET&path=me%2Fnotifications
When I make this request (https://graph.facebook.com/me/notifications), I get only an empty string returned. When I request anything else, I get proper responses. There are no issues with access tokens or permissions.
Can someone help me out?
Are you sure you have the manage_notifications permission?
Do you definitely have no unread notifications? There'll only be values there in the case where your user has new notifications (i.e the third jewel on www.facebook.com is red and has a number)
If you're trying to check for recent (but read) notifications make sure you're including include_read=1 as a parameter to the call to /{user id}/notifications