Can I use a Slack bot to count how many times each user has posted a message in multiple channels without joining those channels? - api

I want to use the Slack API to aggregate how many times each user in Slack has posted a message in a specific period of time. The conditions are as follows.
Multiple channels are covered
Both public and private channels are covered
So here's what I'd like to ask you;
I've read the official Slack API documentation, and apparently there are no direct API methods suitable for the above kind of aggregation, is that correct?
If the above is correct, I think the only way is to parse the text from the text property, which is the return value of the conversation.history method, and aggregate it, is that correct?

Unfortunately, there is no out-of-the-box method that will enable you to get that exact data. A bot needs to be in a channel if it's going to call conversations.history. You'd need to identify the id of the user[s] and filter through the response payload to get the aggregate number of messages for that user. However, moving forward you can use the Events API with the [messages][2] event type. This way your app will be notified of all messages in a channel in real time.

Related

In the Twitter REST API, is it possible to find the reply count?

In the Twitter REST API, is it possible to find the reply count? I see retweet_count and favorite_count. However, I'd like to get the reply count, which you can see in any of the GUIs next to the text bubble icon (see below on the left).
As far as I can tell, there's no direct way to get this data point; one would have to do two or more api hits to collect that count. Am I missing something?
The twitter API doesn't provide a field for reply count but there are work arounds which can help.
But there are few points which are very tricky as each reply even by the same person is counted (much like a dialogue) handling that to count it once is a tricky task.
you can find further details here
Check this link : https://developer.twitter.com/en/docs/twitter-api/metrics
data.public_metrics.reply_count
A count of how many times the Tweet has been replied to.
Using the public_metrics field, this will return the total count of replies from both organic and paid contexts, in order to maintain consistency with the counts shown publicly on Twitter.
data.organic_metrics.reply_count
Using the organic_metrics field, this returns the total count of replies from organic contexts.
data.promoted_metrics.reply_count
Using the promoted_metrics field, this returns the total count of replies from paid contexts.

Social Tables data model

I've just started looking at the documentation as we are going to need to integrate Salesforce with Social Tables shortly, so I am really new to Social Tables.
Specifically, we will need to sync data between the CRM and Social Tables Events and Guests, and maybe other objects, so it would be very helpful to have a data model or similar to check the relationships and fields available in Social Tables architecture.
I haven't found anything in the documentation, is there any way to get this, even if it's at a high level?
Thanks
Danny
To make an integration with SocialTables you'll have to do a few manual steps, there is no way to do this completely programmatic from my experience. You'll also have to be prepared to contact SocialTables to get get correct guestlist ids. Also keep in mind that the API documentation isn't always correct, the API logic is also quite difficult to understand from time to time.
The first thing you need to do is figure out which version of the Venue Mapper you use. You'd want to use the 4.0 api and as far as I know this version of the api is only supported by Venue Mapper 3.0. I believe the Venue Mapper 3.0 is the frontend tool SocialTables provides to do the venue planning.
In social tables an event has two ids, one numerical one and one alpha-numerical one, when you use the 4.0/events endpoint you only get the alpha-numerical event id, and your going to need the numerical one. The only way I've been able to get the numerical id is to pull it out from the url when using the Venue Mapper, example of the url follows below:
https://plan.socialtables.com/team/{team_id}/event/{event_id}/space/{space_id}
Now you need to get the guestlist id, you can get that by using the following url, using the numerical event id:
GET https://api.socialtables.com/4.0/diagrams?event={numerical_event_id}
This endpoint return a json structure where one of the parameters is "guestlist_id".
Please be aware that the guestlist id you get from this endpoint might not be the correct one. I struggled quite a bit with this part and ended up with SocialTables sending me the guestlist id by email.
To get the guests in your guestlist use the following api endpoint:
GET https://api.socialtables.com/4.0/guestlists/{guestlist_id}
The {guestlist_id} is an alpha-numerical string similar to: cfdac1c0-yb1d-12e6-84a5-a39e92131645
And by that you should hopefully get access to your guests.
Hey thanks for using our API.
To answer your question, the best way to see the data model at the moment is to access our developer portal and use the API console to see what is returned. For events you will need to know the team id of the team you are working with use the team events endpoint to get access to the event ids.
https://developer.socialtables.com/api-console#!/Events/get_4_0_legacyvm3_teams_team_events
This will return some basic information about each event for that team. You can then request additional details for specific events by using this endpoint:
https://developer.socialtables.com/api-console#!/Events/get_4_0_legacyvm3_events_event

Perform a action on specific time using Parse

I want to declare a winner of a game when ever its time expires.
is there any functionality in parse to perform an action on a specific time.
Qaiser,
As far as I am aware, there is no way to use a timer in the CloudCode on Parse. They have a 3 second timeout on cloud operations. I am assuming from your question statement that the time expires on a client device and then you want to use Parse to send a message to all other participants of the game that the time has expired and a winner has been named.
Personally, I would use a single timer in the "Leader" of the game to update "gameOver" and "winner" keys within a "game" object that holds all relevant data for your game. However, this structure is subject to the moving pieces within your specific game (without more information, I cannot suggest an alternative). In each client, I would use a timer to request an update of the "game" object every couple of seconds to keep non-leader users up to date. Once those fields have been set, then their clients know that the game has ended and a winner has been named.
I am unaware of any functionality in Parse to implement a model-observer scheme where Parse would automatically send an update to every observing client. If this is key to your game, then perhaps looking at Firebase would be helpful because that is integral to the way that Firebase structures its database scheme. However, the system is slightly more rudimentary and hierarchal than Parse, so it might not suit the rest of your application quite as well.
Hope this helps!

How to get reposted tracks from my activities?

Using the Souncloud API, I'd like to retrieve the reposted tracks from my activities. The /me/activities endpoint seems suited for this and I tried the different types provided.
However, I didn't find out how to get that data. Does anyone know?
Replace User Id, limit and offset with what you need:
https://api-v2.soundcloud.com/profile/soundcloud:users:41691970?limit=50&offset=0
You could try the following approach:
Get the users that shared a track via /tracks/{id}/shared-to/users endpoint.
Fetch the tracks postet by this user via /tracks endpoint, as the _user_id_ is contained.
Compare the tracks metadata with the one you originally posted.
I am not into the Soundcloud API, but taking a close look at it seems to make this approach at least as technical possible, though e.g. fetching all tracks won't be a production solution, of course. It's more a hint. Perhaps reposting means something totally different in this context.
And the specified entpoint exists in the general api doc, so I don't know if you would have to extend the java-api-wrapper for using it.

Should one be able to register the same device multiple times without getting a canoncial id on the "duplicate" registrations?

I'v implemented the GCM, but have some points it seems I didn't follow understand.
GCM have a concept of Canonical Ids, in which if the client registers two or more times, and you from the server sends messages to these Google will return a (the) canonical id of the last registered regId ?? When I test this by deliberately not unregister the device it still successfully sends multiple messages to the same device. Have I misunderstood what the canonical id is? Are you suppose to be able to register the device several times ?
Yes you can register the same app/device multiple times, and canonical Ids are designed to help you fix that problem when it arrives. Your server will need to prune your registration ID list when you receive a response with a canonical Id. You can see a response I wrote here: android GCM get original id of canonical id That describes the format and what to do.
This post also contains good information about canonical Ids: GCM and id handling