Tagging in log messages - error-logging

I want to tag the log messages in a given request, you can say in a given functional flow, So that while triaging any defect on the application it will be easy to search the messages based on the tag.

Related

ejabberd message level read receipts

I am using ejabberd with Smack for pushing messages from a Java application and then consuming these messages on a website using bosh/strophe. This works great, and now I have to change the way a message is marked as read. Currently any message (new or old using xep-0313, xep-0136) is 'read' as soon as it's delivered. I want to change it to be marked as read only after the user on the website does an action, e.g. checks a checkbox. So, if a user logs into the portal again, he should see the message as unread as long as he hasn't checked the checkbox for that particular message.
I looked into the following modules, but none seem to be doing what the requirement is -
XEP-0333 - Chat Markers – Not on an individual message level.
XEP-0184 - Message Delivery Receipt – specification doesn't seem to distinguish between delivery and display based on any end-client action
Any inputs/suggestions welcome! Thanks!

Facebook Messenger Send Api - send to a big amount of users

I have a bot over Facebook which people are subscribing for sports updates.
I have 1,000 - 10,000 users I want to send out an update to.
Currently, in small scales like 20 messages , I would use a Facebook Batch request.
But, i'm not sure what would be the best way to send my messages in a large scale.
My two options are:
Batch - limited to 50 requests per batch request.
I don't really know if I should expect a delay in the execution of the request.
Regular calls - I will iterate through my receivers and send each of them a message separately.
I'm afraid Facebook might block me for thinking i'm spamming, or I will exceed the rate limits.
I have to say I was expecting a more generic method coming from Facebook since they are allowing users to subscribe for update through my bot, hence, I was expecting them to provide a guide on what are the best practices for sending the update users subscribed for.
You should definitely use Facebook Messenger Broadcast API for this. This will broadcast your message to all user subscribed to the bot.
Caveats:
You have to apply for this permission. (pages_messaging and pages_messaging_subscriptions.Takes about 1-2 days, but
can test on Admin/Test users of the app)
Each broadcast has to be a separate broadcast. (e.g. you can't send image and a text together, each has to be its own individual broadcast).
Have some kind of un-subscription option as well. FB user might think you are spamming even if you clearly say in the messages that your bot will send updates.
Use custom labels to create targetted sends. So you can either subdivide who you will send updates to about specific issues or just label people if they unsubscribe to your broadcast or not.
Basic workflow:
Get permission to broadcast.
Create message_creative_id via POST to endpoint
Use message_creative_id to POST a broadcast_messages
On a successful send you will get back broadcast_id

XMPP: count of unread messages

I'm trying to implement chat for my webapp with following features:
When user logs in he should see a number of unread messages (which is both offline messages and "unseen", I will explain "unseen" in next step).
When user is anywhere in the app but on chat window he should be notified that he has a new message. Message should be marked "unseen" and must be added to the count of unread messages.
The first point is quite easily achieved using XEP-0013: Flexible Offline Message Retrieval. So I can retrieve offline messages and when I'm sure user has seen them - I remove them from unread list. But the problem is: how do I achieve same thing for "unseen" messages?
In short what I need is: any message should be marked as offline, unless user sees it and it's removed from the list by explicit request.
Can I achieve that with XMPP and how do I do that?
Thanks in advance.
What you are trying to do is to basically store a counter of unseen stuff in your account. I think you do not need flexible offline retrieval as when you connect the messages would simply become unseen. You thus only have to deal with one case: Unseen.
I will reply from the perspective of ejabberd, that I know better as one of the developer: I would use private storage to store your current state of unseen count and conversation.

How to get Complete (Both Sent and Received) Direct messages from Twitter api in single request?

Now i am able to get "Received Direct messages" from twitter and "Sent Direct messages" from twitter.
But i saw an iPhone application Seesmic where direct messages showing as original twitter messages page (Messages). In that iPhone application they showing both sent and received messages in single page.
I could do this by calling both webservices (http://api.twitter.com/version/direct_messages/sent.json,http://api.twitter.com/version/direct_messages.json) and merging both responses and showing it like original twitter inbox (means showing messages to each user as a separate page).
There are only four methods in Twitter Direct Messages
I want to know any other way of getting complete "Direct messages" from twitter in a single request.Is Streaming api is capable of that. There is no enough support in web for streaming api. Please answer me.Thanks in advance.
There is no single API method that provides this. You will have to make two requests and merge them locally. You could use the User Streams API but the streaming API does not provide any historical data. You would start with no DMs and slowly build up a local cache as DMs are sent/received by the user.

Getting list of messages & pokes in API

I've tried using both the old REST API, as well as the Graph API. I can not seem to figure out a way to get a list of ALL messages and pokes (and when I say messages, I mean private messages). These items do not appear in the stream (from what I can tell), so getting them there is not possible. Notification.get() in the REST API only gets unread messages. Any suggestions?
Read the basic Graph-mining tutorial at http://ericosgood.com/prog/facebook-android-sdk-tutorial/#comment-216.
To get information about the user, you need to branch /me, for events branch /me/events, for messages you need to branch me/inbox.
Have a look at: https://developers.facebook.com/docs/reference/api/message/
For pokes use me/pokes.
For both pokes + inbox you'll need the additional permission: read_mailbox.