what is the point of 'timeline' in array or param for get_news_feed? - getstream-io

I went through all tutorials and docs which stream-django provided.
And there was one thing that I could't understand.
I can't find the differences between these feed_manager methods.
# (1)
feed = feed_manager.get_news_feed('timeline', request.id)
# (2)
feed = feed_manager.get_news_feed(request.id)['timeline']
# (3)
feed = feed_manager.get_news_feed(request.id)
Could you explain the difference? Are they doing exactly same thing? timeline means flat feed, then why do we put timeline in param?
Thank you

timeline is the name of the feed group that you've created within Stream.
Once you create a feed group in Stream, you'll select the type of feed group ("flat" in this case, but can also be "aggregated" or "notification"), then, you'll name the feed group - common names are timeline/news_feed (a homepage feed showing activity from other users) or profile/user (a profile page feed showing all activities from a single user). There are no "reserved" words in feed group names.
Re: whether or not these methods are all doing the same thing:
feed_manager.get_news_feed('timeline', request.id) (1) is definitely correct. It'll fetch the feed activities for the specific timeline:1234 feed, where 1234 is most likely your user's ID.
(2) and (3) I'm not sure about - it's likely that they're doing the same thing as (1), but I'm not able to tell at the first glance at the docs.
Hopefully that helps!

Related

Passing More than 1000 parameters in RESTful api

Our Dashboard have dropdown which consist of more than 8k products and we have such 4-5 dropdowns.
I want to filter data based on this dropdowns.
But if I selecting all products then restful api url is breaking.
Can i use azure bus service or similar message broker service to pass this complex and multiple parameters via service and which then consumed by all apis??
While I do understand what your need is I will suggest to re-think your approach as that will lead to a better user experience.
I will use a first drop down, completely empty, that will fill in options while the user types in whatever product list you have, that way, there is only a group of items that are filled in that the user is interested in.
I will also suggest not to load anything on that drop down until the user has entered, let's say, 5 characters.
After that let the user select an item from the dropdown, and filter the second drop down and continue to use the same technique with all drop downs you have.
Let me know if you have any questions around this approach and I will be more than happy to provide an example if you don't know how to do it.
Edit:
Including samples for load dropdown lists dynamically and also another post with an example on how to return some JSON from an Azure Function that can return the data in a dynamic way like you need.
From what I can see I think it'll be helpful for you to go through several different examples that can bring you progressive knowledge to what you need to achieve, first of all it'll be nice if you know how to load items dynamically on a dropdown list:
That is a nice example, you can have an entry where the user can type
whatever products you have and then they type, lets say, more than 5
characters go and search for that data.
https://www.codebyamir.com/blog/populate-a-select-dropdown-list-with-json
This other example shows you how to return data from an azure function
with the data that you need to show the users. This is not exactly
what you need as you need to receive a parameter with what the user
typed and search in your database for the items that match that search
and return that data in a JSON format so you can use it on your web
page to show the dropdown list. I will suggest to initially hard code
a few items and return those to check that the functionality is there
and once you have that up and running move to get the actual data from
the database.
How to return a JSON object from an Azure Function with Node.js

Avoiding duplicates in different feeds with getstream.io

Let's say I want to build a system where each user has access to a notification feed and an aggregated feed, with the following groups:
user as flat feed
hashtag as flat feed
notification as notification feed
timeline as aggregated feed
We also have the following relations:
user:b follows hashtag:a
user:b follows user:a
Now consider the following situation:
If user A posts with hashtag A, I would like user B to get an activity in its notification feed (thanks to relation 1). But I also would also like all followers of user A to see in their timeline that user A did something. Then, user B will get the activity in its notification feed, and in its timeline (because of relation 2): there is a duplicate.
Is there a way to avoid this situation ?
A naive way would be to manually filter the feed and prune the aggregated activities we do not want to see. But this of course seems non optimal.
Thank you very much!
You can use discard rules to avoid activities matching one of rule from getting added to a follower's feed.
This is usually something you use to avoid own activities from showing up in your notification feed.
Here's the link to the docs on Discard Rules:
https://getstream.io/docs/#discard-rules

DialogFlow - 1 word trigger 2 entities

For my project I need to trigger 2 entities by one word. I have two entities with list of restaurant types the restaurant_type_id and restaurant_type. In the responses I am using $restaurant_type, but I need also to trigger the id of the restaurant type that is inside restaurant_type_id.
In the example below you can see that only one of the entities is triggered.
Is there a way to do that or that is not possible? I have tried looking for more information, but couldn't find anything in the DialogFlow Docs.
One way of getting the id as well as the name is by asking the Dialogflow to send the original value along with the resolved one.
To do this, you can create one single entity like below,
Next in the intent section under the parameter, you can tell the Dialogflow to send both the original and resolved data.
Now you have both the id and name.
In order to work the above answer, you will have to follow this rule. Otherwise, it won't recognise.

Sending specific words to webhook

I'm trying to make an agent that can give me details about movies.
For example, the user says "Tell me about (movie-name)", which sends a post request to my API with the (movie-name) which then returns the response.
However, I don't understand how to grab the movie name from the user's speech without creating a movieName entity with a list of all the movies out there. I just want to grab the next word the user says after "tell me about" and store it as a parameter. How do I go about achieving that?
Yes, you must create a movieName entity, but you do not need to create a list of all movies. Maybe you are experienced with Alexa which requires a list of suggested values, but in api.ai you don't need to do that.
I find that api.ai is not very good at figuring out which words are part of a free-form entity like movieName, but hopefully adding enough user expressions will help it with that.
edit: the entity I was thinking of is '#sys.any' but maybe it would be better to use a list of movie names with the 'automated expansion' feature. I haven't tried that, but it sounds like the way that Alexa's custom slots work, which is actually a lot more flexible (just using the list as a guideline) then people seem to think.

Advanced Find giving wrong(?) result

I am using Microsoft Dynamics CRM 2011.
I have to get all the activities which are of type Appointment, Campaign Activity, E-mail, Opportunity Close, Phone Call, Recurring Appointment or Task. There are some more filters added as per my need. I am using Advanced Find for this one. Till this, my advanced find looks like:
It is returning me results, which are valid.
Now, I want to add another clause to this and shortlist the results which I am getting till now. The clause is: Don't show me the activities (most of which are E-mails) in which sender or recipient contains 'Test'.
For this I have designed following:
As per me, this should give correct results, but this is returning me no records.
The way I read your requirement:
Don't show me the activities (most of which are E-mails) in which
sender or recipient contains 'Test'.
It can be rewritten as: Show me all activities where:
Sender contains data
Sender does not contain test
To Recipient contains data
To Recipient does not contain test
That can be done in the following way (where you go down to the Sender Activity Party, back up to Activity and then down to the To Recipient Activity Party):
This approach requires that the returned Activities have both types of Activity Party (which is probably only true for most Emails), which might not be what you intended.
To keep it simpler, you might be able to do with simply avoiding any Activity Party containing test:
Note that also this approach (as well as your approach) only shows Activities that actually have an Activity Party.
just wondering if your activity party conditions should be grouped under "OR".. otherwise, it's "AND" altogether, so you are currently looking for the activities where your activity party is both a sender and a recipient.. In other words, maybe this would work?
You need to go deeper:
(pardon the ASCII art, don't have a screenshot at hand now: this is how the advanced find window should look)
Look for: Activities
Activity Type Equals E-Mail;...
(put all the other conditions here)
Activity Parties (Activity)
Participation Type Equals Sender;To Recipient
Party(User)
Full Name Does Not Contain test
In this PoC I'm assuming all parties are System Users. You cannot mix different kinds of activity parties (such as, an e-mail sent to a contact).

Resources