I need to send a message in slack at a time set in advance.
Is there a way to do it through the Slack API or do I need to have a script running and checking if it's time to send the message and then send it?
You should be able to create a reminder sending a message to #slackbot
The message should be like:
/remind [#someone or #channel] [what] [when]
Here's some examples:
/remind #username to do something in 24 hours
or:
/remind #username to do something at 16:00
You can use this free Slack application to send scheduled and self-destruct messages.
https://timy.website
Sending a scheduled message
/send Happy birthday at 12am
/send Happy birthday in 1h30m
Sending a self-destruct message
/delete Secret message! at 2pm
/delete Secret message! in 3h
You can find more details on the website.
If you just want to send a short message to a user at a given time you can use the build-in reminder. The reminder.add method allows you to specify a date, time, message text and the user to receive the message.
The reminder message will appear in the "Slackbot" channel of the addressed user.
Here is an example on how it would look like:
Update April 2019:
There is now a new API method that allows you to submit message for later sending. Its called chat.scheduleMessage.
You can use the official slack api at endpoint chat.postMessage with a key post_at to have your message scheduled. More information in official slack documentation https://api.slack.com/messaging/scheduling. You can also use 3rd party applications, which are free most of the time, for example https://thetopchat.com/ and schedule your message with commands like, for example:
/delay in 3 hours {your message here}
or
/schedule tomorrow at 3pm {your message here}
The Slack API now provides a dedicated endpoint for that. You will need the chat:write scope and the docs say:
Schedules a message to be sent to a channel.
I just implemented it and works as expected.
You can check the docs here: chat.scheduleMessage
Related
I'm trying to set a webhook callback that will be called by Twilio Studio at every stage of a posted message journey and send the activity status back to the webhook I set.
Studio Create Method (What Im currently using)
client.studio \
.v2 \
.flows(TwilioConstants.TWILIOFLOW_PROXY) \
.executions \
.create(
to=f'whatsapp:{user_number}',
from_=f'whatsapp:{TwilioConstants.BASENUMBER}',
parameters={
'name': data.customer.name,
'user_email': data.customer.email}
)
the create method will only accept 3 arguments
create(self, to, from_, parameters=values.unset):
However the messages create method accepts many arguments including the status_callback
client.messages.create
Can anyone tell me how I can get real-time individual WhatsApp message detailed updates sent to a webhook I set myself?
I have tried setting the webhook in:
WhatsApp Sender -> Status callback URL
but that appears to only send very granular data back and only when the user interacts with the message (to be fair I've not let the message timeout yet but possibly this would also be triggered if this happened or an error was encountered)
What I would like is more detailed information being posted back to my webhook such as found in Monitor -> Messaging -> Message Details
Any help with this one would be very much appreciated.
You are right; there is no status callback available in the Studio API. However, you can invoke your "own status callback" by using the Send HTTP Request widget within Studio.
You can either send all the needed parameters in that request or just the execution SID and then use the Execution API to fetch the details about the current step.
I'm trying to get an email notification when my "on-premise TFS 2018" receives a new "voluntary feedback".
I already have a "work item notification" that generates an email when a work item status changes, but a "Feedback response" doesn't apply to this rule.
The current subscription is the one in the image
How can I trigger an e-mail on the "new feedback received"?
The statuses of the Feedback Response work item are Active and Closed, you'll need to change your filter so detect the first state in order to receive your notification.
The feedback client pre-fills this value as far as I know and the value will therefore never be empty on the server if the tools are used the way they should.
I'm using Firebase Messaging to send out notifications to users of my iPhone app. My database is structured like this:
- Users
- user1
- user2
- Groups
- group1
- members
- user1
- user2
When a user joins a group they get subscribed to a topic corresponding to that group. I have a cloud function that listens for writes in that group, and sends a notification to the groups topic when a write happens:
exports.sendNotifs = functions.database
.ref('pets/{petId}/events/{eventId}').onWrite(event => {
const pet_Id = event.params.petId;
const payload = {
'notification': {
'title': `${toTitleCase(name)} just logged an event`,
'body': `${events[eventType]} for ${toTitleCase(petName)}`,
'sound': 'default',
}
};
admin.messaging().sendToTopic(pet_Id, payload);
});
However, this results in everybody getting a notification including the person who did the write that triggered the notification. I only want other people in the group to display a notification since the triggering user doesn't need to see one. I tried appending the sending user's uid as extra data of the notification and only displaying the notification if the recieving user's uid doesn't match the notification data's uid. This works when the application is in the foreground but not if its in the background, so if the user writes then closes the application before he receives the notification it'll display for him when he receives it, something I'm trying to avoid.
How can I make sure only other members of a group get a notification? Are messaging topics not good for this?
If you use Topics it's not possible to send to everyone except one.
If you are Ok sending to everyone, and then filtering on the client, you will need to use the data messages, and not notification messages, to avoid the problem with background/foreground you described.
https://firebase.google.com/docs/cloud-messaging/concept-options
i guess that the solution is:
each iOS client from group1 will subscribe to topic /topics/group1.selfUserId
the server already have the list with all users that are part of group1
the iOS client ask server to send notification to group1.members beside selfUserId (make a http post request)
server send gets all group1.members beside selfUserId and send notification to all /topics/group1.memberX
As already mentioned, you cannot exclude someone who has been registered to a Topic.
So what you can do is sending a message to a single device. So for example you have a group of ten persons, one person posts a message, you have to send nine single messages to the other nine persons of the group.
What you need to do is to store the registration token of every single user into your database and you have to take into account that registration tokens will change after some time.
Using a production key on Mandrill I am attempting to send an email. Previously this has worked without issue. However now, despite receiving a successful response from the API, visible in the api log, no email is being sent, and nothing is present in the outbound activity log.
If I check the api log for the message which appeared to fail it displays:
[
{
"email": [email_address],
"status": "sent",
"_id": [id],
"reject_reason": null
}
]
Replacing the id in the content view of a sent email, with the id from a failed one displays a correctly formatted email:
e.g. https://mandrillapp.com/activity/content?id=20151214_[put_the_id_here]
Is this a bug? What is causing it? Where can I see more information about what happened? How can I monitor if this happens again in the future? How can I prevent it from happening in the future?
I have been in contact with Mandrill support regarding the issue, which they described as 'very strange indeed'. Deleting the API key and generating a new one fixed the issue, but there is no explanation as to why this is they case, how to detect the problem, or how to stop it from happening again in the future.
The messages in question were never actually sent by Mandrill, and displayed no SMTP events, despite reporting as sent by their API
Something else to check is to make sure you're using a working API key instead of a test one. As the name suggests, test keys are designed to work just like a regular key, so the feedback to your program will be identical, but the messages won't actually be sent.
You can see if this is the problem by going to the Mandrill settings and looking at the list of API keys. Test keys have a very clear This is a test key message listed.
This probably won't be an issue if you generated the key yourself, but if you inherited this project it's worth taking a look.
I have faced a similar issue like this last week. The "sent" status only indicates that Mandrill sent it. But reception of the email message is confirmed only if there is a SMTP event corresponding to it with code starting with 2, (example 250 etc), in the info api response, like the following:
"smtp_events": [
{
"ts": 1442448422,
"type": "sent",
"diag": "250 SmtpThread-4622542-14682902148#ps-they-19.uk.miplecast.lan Received OK",
"source_ip": "505.207.171.171",
"destination_ip": "705.139.255.221",
"size": 29501
}
check this link for more info.
https://mandrill.zendesk.com/hc/en-us/articles/205582697-How-to-Confirm-If-an-Email-Was-Actually-Delivered
the issue could be on the recipient server as well, due which delivery could be delayed. In our experience last week, the message was delivered 4 hours after being Sent. we were not able to establish the reason yet why, this delay happened.
HTH,
I have quite silly question: how to send notifications?
For example, when I register user on my app, I want to welcome him/her with
notification.
Assuming you're using Facebooker (which, really, you should be), you can create a Publisher class.
You can also use facebook_session.send_notification([user_fb_id], "notification message") (in your controller). This will be an app-to-user notification, and you have a limited number that you can send to users each week.
To see this limit you can use the following call:
Facebooker::Session.create.post('facebook.admin.getAllocation', :integration_point_name => 'announcement_notifications_per_week')