can users follow specific Django model IDs - getstream-io

I'm quite new to GetStream. After successfully testing/using the default feeds, now I would need that users could choose within one Django Model several records to follow, e.g. user1 follows Model IDs=1,10,20 updates; user2 follows model IDs=1,30,40 updates and so on.
A Celery task can update Model records and users that are following specific IDs should get a notification if the records were updated.
Is it possible?
If so how? I sincerely don't have a clue how to do it.
A huge thanks GetStream for all great resources!
D

We have some code in the Django SDK called feed_manager.get_notification_feed() which can get a notification feed name for users based on an activity type. Our README file talks about doing this in a Tweet model here. You might need to adapt some code to your specific use case.
Our Python SDK has a function for building a batch of follow requests to help manage user:1 follows model:1, user:1 follows model:10 and so on; check out the follow_many code here.

Related

How to model account logic?

Say, I want to create an account system. there is a user id, user name, user email and other fields.
I have the following "find_by" scenarios, so I will also have some "find_by" tables such as account_by_name, account_by_email.
When create an account, I need to check whether the name or email has already been used or not.
Considering the restrictions of batch and lwt, how to accomplish the logic above?
Try looking at the KillrVideo example project. You can look at the schema to see how the user tables were modeled, and look at the user DAO code to see how users are created using LWT. KillrVideo also has examples using other programming languages; you will find links to all the github repos on their website.

Spring Data Rest Frontend deep linking

So i have been struggling with this one question some time now:
How to handle details Page or deep linking on the Frontend.
So, say, we got a paged collection endpoint with user entities in it and a React App consuming the endpoint.
The flow would be, user authenticates, gets collections, clicks on an item and is either:
Redirected to a new Url say: webapp.com/users/userid
A modal opens with the user details.
Say we got a scenario were two people working with the webapp, Person 1 wants to share a link with Person 2. Person 2 should do some updates on a specific user, which is identified by the link.
The link should be something like : https://www.webapp.com/users/{slug or id}
With Option 2 this functionality is not mappable.
With Option 1 we got to expose the ids in the response to identify the resource, which may work, but we would still need to hardcode the url, as the findById method is not exported as a Uri Template.
So, my Solution would be to add a slug for the resources, implement a search method by the slug, and then get the user, if found, by its self-link.
Sounds like a good solution for me, but on the other hand, I would have to add an extra frontend id(the slug here) which would need to be also unique, to the database model.
So how do you guys handle a problem like this, or is there anybody using spring data rest in this way or in production mode where you have the handle situations like this?
Should mention that this isn’t a primary problem with spring data rest but rather with hateoas itself.
thanks in advance
Florian
You don't need to hardcode URL template. Spring data rest will generate links for each resource.
You can refer to it from front end by some format like: {your_user_object}._links.self.href

How to train api.ai/dialogflow chatbot dynamically?

I am trying to generate some "quick reply templates" i.e possible reply according to previous messages in a chat thread using Api.ai/Dialogflow.
I have trained api.ai agent to some extent to generate replies only for some selected queries. Now, I want to enhance it to generate replies for more queries but training an agent manually for a large number of queries is not practically possible. Is there any way to train the api.ai chatbot dynamically by analysing the previous chat thread, i already have stored in db or using the data of ongoing chats.
Users are some sellers so i assume they will talk regarding there product only, so questions will be somewhat similar in every chat thread.
Looks like there is now the ability to train via the API: https://dialogflow.com/docs/training, along with uploading text files with training lists.
You can add more Training Phrases using the POST and PUT API methods for the /intents endpoint.
Any changes made via the API to alter the agent's behavior, initiate the training in the same way when you save an intent. This trains the agent with the changes delievered through the API.
There currently isn't a API for training.
If you have a log of the queries for your agent (via the API or your webhook), you could "train" your agent by using those log to determine the most common unanswered queries by looking at how many queries match the default fallback intent and create new intents and responses for those queries using Dialogflow's API: https://dialogflow.com/docs/reference/agent/intents#post_intents

Create contact without user

I try to create a contact that is not associated to an user. All "real" users are imported from LDAP. I want to show a global contact list for different purposes like a birthday-list and a phone book. Not all entries in these lists are imported as users. Now I want to create these contacts with the ContactLocalServiceUtil class programmatically. Are there any advices how to do this? There is no method that needs neither a user-id nor a contact-id.
A Contact, as contained in Liferay's API, is always the contact data of a user. Just because the name describes what you need, does not mean that the underlying concept matches as well. You probably need different data for a general purpose phone book anyways and it's probably easier to introduce your own contact class than adjusting the existing model (you can't add fields to API classes anyway - your only way of extending Liferay's ContactModel would be through Expando fields)
Therefor the advice is: Create your own contact class. If you want to react to user data changes when LDAP is updated, you'll need to frequently import the user data and for example create a model listener on Liferay's contact that updates your custom contacts whenever an update from LDAP is coming in.

How to provide Detail and Summary objects for my REST api with Node.js and Mongoose?

I want to provide some venue information over my node.js REST API build by mongoose and express.
In my model, I should take care of every details for a venue.
But when requested for summary, I should show only some of them.
And If requested for 1 venue in detail, I should show more.
What is the best way to do it?
If you want to achieve something like this why not create some custom queries for your detail and summary actions?
Basically what you need to do.
Create your custom queries that received the custom data.Do this in your model. (e.g the data for summary or details)
Create specific actions for these speficic type of API calls in your controllers and server it as you wish. (E.g create /getVenueDetail/venueId=213235 )

Resources