User mentions are a way of letting one or more users that you mentioned them in a tweet. These users will receive a “mention” notification letting them know there were mentioned in your tweet.
Since we have a new type of notification, we need to update the type property of the Notification entity and also its model:
This is a really easy one because it doesn’t involve any new entities. All we need to do is to update the endpoint that created a new tweet to send mention notifications:
This is the entire tweet creation functionality from our Twitter clone app. To send a user mention notifications we just search the usernames in the tweet’s content and insert a specific notification in the database.
Let’s make a request to test this feature:
Now, a user named joe should get a ‘mention’ notification.