I'm building an application based on Laravel 5.6 with live chat functionality (uses Pushier).
I need to notify Users via email about new messages. The problem is that I should not send notification each time as message sent because user can be online and receive this message. Also if theme were 20 messages in a minute I do not need to send 20 emails, just one with "you have new messages".
My idea is:
1. on each message I have a Laravel Notification "Message received". If user online - notification deletes. So in notifications table I have notifications about unreceived messages.
2. I should run Task (e.g. each 15 min) and if there Notification(s) for User - sent email "You have unread messages".
3. Now I have the problem that if user won't read notifications during 15 min - he will receive email again.. So I need to store in some table (or expand current notification table with mark) data about Notifications that already was emailed.
Is my approach correct?
Thanks!
Related
When sending notifications in DeepstreamIO, if a user is offline and later reconnects, he will not see the notification. In addition to that records is empty. Can you please suggest any solution?
I try to send notifications to many users, I found that if I send for example 3 notifs the user received the last one, but if he is offline and the reconnect, he can't notify.
I want my bot to send the user a message after every 3 messages(activities) the user send. Is there a method in the bot framework to detect the number of the activity sent or the count of all past activities?
A bot is stateless by default, however you could save the 'activity counter' in the user / conversation data. Retrieve and increment this counter at every incoming message.
Microsoft Docs: Save user and conversation data
In my application, I have about 50 users that need to send and receive SMS. How would I integrate this using Twilio? Do I need a number per user so that when they revive an SMS, I can show it to a specific user only?
The link below shows how to receive SMS, but I need help storing/displaying the SMS to the correct user only.
Laravel/Twilio Receiving SMS
Whenever my app posts ephemeral message to Slack channel (in response to a query by a user), I am unable to get the timestamp of my Slack app response. As I want to delete it once the user has made a selection using one of the buttons. Although I have subscribed to 'message.channels' event, I don't get a notification to my app whenever my app posts in the channel (in response to the user input), therefore, I am unable to get the timestamp of the message which I'll use to delete it. All I want is the timestamp of the message posted by my app so that I can delete it but I am unable to receive the timestamp. Please help!
For e.g. in Giphy app for Slack. Let's say the user invokes the app by calling '/giphy [dog]' where 'dog' is just an example of a search term. The app responds by sending a gif and user can either send it, shuffle to the next one or cancel it. I want a similar capability of cancelling the app response but I need the timestamp of the message in order to do so therefore I am asking for help.
Thanks.
Your approach can not work, because Slack is handling ephemeral messages differently from "normal" messages. They are only visible by one user and can not be modified by API methods (e.g. deletion).
But of course its possible to replace ephemeral messages. Here is how:
Your app can just reply to the interactive message request from Slack with a new message. That new message will by default override the original message including ephemeral messages.
You can reply in two ways:
Directly reply to the request from Slack with a message within 3 seconds
Send a message to the response_url from the Slack request within 30 minutes.
See here for the official documentation on how to respond to interactive messages.
This approach works both with interactive messages and slash commands.
See also this answer for a similar situation.
I have successfully setup my slack bot app, have enabled events etc. I want to receive any direct messages that the members of my slack team send to my bot. For this, I have only enabled Bot Events and No Team Events like below
However, I do not get any event on my webhook on this setting.
If I enable message.im event under Team Events, then I start getting events. But then, I get every message that the user (who has installed the app) sends to any other user in the team.
How do I get only the messages that are sent to my bot user?
Update 1
Based on this SO question I created a private channel with the bot user. Even then, the messages in the private channel do not arrive in my webhook with the above event subscriptions.
Update 2
After reinstalling the app, it seems to be working fine. I have only used it for few minutes after the reinstall so far. I will keep posting here how it goes. It would still be interesting to know what went wrong where.
It is normal behavior that your script receives all messages (for every channel your bot is a member of), not only the messages sent directly to your bot. At this time you can not filter further in the event configuration. So you need to filter out any unwanted message in your script handling the event.
See also this answer.