Read page messages - restfb

Im aware, that read_mailbox permission was removed in FB API>2.4. I need access to page related messages. So i have a page and someone is sending private message on this page (not directly to the user). Is there any API to read such messages?
So i need something like:
Connection<Conversation> conversations = facebookClient.fetchConnection("me/conversations", Conversation.class);
For page related messages,
Such API is available?
Best regards, KB

It depends on your use case.
The API you mention is already available, but you can only use it to read private Messages.
I suggest to use the messenger platform webhook. This can trigger a poll on me/conversations if you need the whole thread. If you are only interested in the content of the incoming message, you don't need your endpoint and work only with the messenger platform. Webhook + Send API may be enough: https://developers.facebook.com/docs/messenger-platform

Related

How to subscribe to Salesforce connected app webhooks?

I want to implement a connected OAuth app in Salesforce which should trigger push events in case some entities changed, for example an opportunity was closed.
Zapier implemented something similar
https://zapier.com/apps/salesforce/integrations/webhook
Could not find something I need which is a simple way to subscribe to entity changes using the OAuth client's token and passing a webhook endpoint. I read about apex callouts, streaming API and outbound messages.
Yeah, we solved this exact problem at Fusebit and I can help you understand the process as well.
Typically speaking here's what you need to do:
Create triggers on the Salesforce Objects you want to get updates for
Upload Apex class that will send an outgoing message to a pre-determined URL
Enable Remote Site Setting for the Domain you want to send the message to
Add in Secret Verification (or other auth method) to prevent spamming of your external URL
If you're leveraging javascript, then you can use the jsforce sdk & salesforce tooling API to push the code into the salesforce instance AFTER the Auth flow has occurred AND on Salesforce Instances that have API access enabled (typically - this is enterprise and above OR professional with API enabled).
This will be helpful for you to look through: https://jamesward.com/2014/06/30/create-webhooks-on-salesforce-com/
FYI - Zapier's webhooks implementation is actually polling every 15 minutes, instead of real-time incoming events.
In which programming language?
For consuming outbound messages you just need to be able to accept an XML message and send back "Ack" message to acknowledge receiving, otherwise SF will keep trying to resend it for 24h.
For consuming platform events / streaming API / Change Data Capture (CDC) you'll need to raise the event in SF (Platform Event you could raise from code, flow, process builder, CDC would happen automatically, you just tell it which objects it should track).
And then in client app you'd need to login to SF (SOAP or REST API), subscribe to channel (any library that supports cometd should be fine). Have you seen "EMP Connector", mentioned for example in https://trailhead.salesforce.com/en/content/learn/modules/change-data-capture/subscribe-to-events?trail_id=architect-solutions-with-the-right-api ?
Picking right messaging way is an art, there's free course that can help: https://trailhead.salesforce.com/en/content/learn/trails/architect-solutions-with-the-right-api
And pretty awesome PDF if you want to study for certification: https://resources.docs.salesforce.com/sfdc/pdf/integration_patterns_and_practices.pdf

How to request read receipt with Google App Engine

I have a GAE application which sends out email to my domain users in a Google Apps for Business environment. I am using JavaMail as described in this article. Unfortunately I can't seem to find a way to ask for a read receipt. I looked at Message methods but nothing seems to suggest that it is possible. Thanks a lot.
If you're interested in knowing if a mail bounced, then use bounce notification https://developers.google.com/appengine/docs/java/mail/bounce
For read receipts:
As far as I'm aware, you need to roll your own read receipt functionality. For example: Include an image(with a unique url) in the mail you send out. When the recipient opens the mail, the image is retrieved and you can determine whether the mail has been read. This has it's downsides; if they don't have images enabled, then you won't receive the notification.
You need to set the appropriate headers on your message, as described in Message Disposition Notification - RFC 3798. Not all mailers will honor MDNs, so you might find the tracking pixel useful as well. But then some mailers won't display remote images, so in the end there's no guaranteed way of getting notified when a message is read.

GAE: Only one channel to a page? How is this enforced?

This may be a naive question but I was planning to create a new channel just before the existing channel timed out to make sure that my client was never without a channel. I thought I was being pretty clever until I read this caveat in the google channel api docs:
One Client Per Channel Per Page
A client can only connect to one channel per page. If an application needs to send multiple types of data to a client, aggregate it on the server side and send it to appropriate handlers in the client’s socket.onmessage callback.
I'm new to this, but it's not obvious to me how the channel unique identifies the page to which it is connected. Is there something in the javascript for channel.open() call that identifies the page it is being called in?
Thanks.
The channel javascript creates a hidden iframe with a given id (on production). The communications takes place within the iframe. The javascript code will always access that iframe (and hence channel).
When you close the socket and channel, the hidden iframe will be destroyed. Afterwards you can create a new channe for the page.

feedback form for WP7 app

How would I go about implementing a feedback function on a windows phone 7 app? I've considered creating a form that sends an email with the data to an address I own, but I wonder if there is a better solution.
I personally think the simplest and best solution is to use EmailComposeTask to send the feedback via email.
You could either just put some questions/suggested text in the Body - or you could fill the Body in with some information from a SL form.
One of the advantages of the EmailComposeTask is you will definitely get their email address to reply to. Another advantage is that the feedback will work even when there isn't currently a network connection - it'll just get added to the outbox for later processing.
Well, I would create a webservice that can receive that data. It could be useful in case you have a backend system that can make some data statistics.
You can refer to that post that contains some code about data sending to a web service: WP7 app never exits BeginGetResponse and goes into the callback function
Regards.

How can I send messages to clients without polling?

Every example for GAE Chats uses some kind of polling. However, if my GAE app holds a list of clients (in the datastore if necessary), perhaps I could avoid polling by sending a message to all these clients. How can I achieve this?
If you are talking about HTTP, the short answer is that GAE does not currently support it. What I think you are asking about is sometimes called BOSH. Once WebSockets become more widespread, they will be an excellent solution for this problem.
In the mean time you might want to look at XMPP. Using XMPP you can avoid polling. Google has announced a Channel API (yet to be released) which will basically give you the same features as websockets.
You've probably seen some chat room examples...
Since you just want to send a message to users on your datastore (Tip: the IMProperty is great to store such data), it's just a matter of directly sending the message:
from google.appengine.api import xmpp
# `destination` is a list of JIDS
# `message` is a normal unicode string
xmpp.send_message(destination, message)
You can find a great tutorial on using XMPP by Nick Johnson here
Note that you can now use the App Engine Channel API for this: http://code.google.com/appengine/docs/python/channel/
You can create a channel for a given client using:
channel.create_channel(client_id)
Then when you want to update that client, send a message:
channel.send_message(client_id, message)
Basically each client will get a persistent connection that you can push messages over.

Resources