Ignore events generated from method invocations - slack-api

I have the following case:
1) A user sends a direct message to my bot (which has been installed with the Slack app).
2) The message generates an event which is sent to a webhook on my server. The message gets processed, and a response is sent to the user (via the chat.postMessage api (https://api.slack.com/methods/chat.postMessage)).
3) Now, another event is generated (with type "message", and subtype "bot_message") and sent to my webhook.
Is it possible when sending a message (with the chat.postMessage method) to make Slack not generate a corresponding event? (Since I'm the one sending the message, it is completely unnecessary for me to receive an event telling me that I have indeed sent a message.)

No, I don't think it is possible. You can not subscribe to specific message sub_types.
I had the same issue when using the message events and I just told my bot to ignore all messages that have a sub_type.

Related

How to obtain final STATUS from a text sent to mobile phone

I am sending a text to a mobile number (US phone number) using the Programmable Messaging Quickstart for C# with .NET Core example. The message is sent and received successfully but the STATUS in the response shows "queued".
Is there a sample callback in C# to obtain the final status after the text is sent?
You have 3 options, either of the first two are suggested.
Subscribe to statusCallbacks, which will alert your application of the delivery status of the send message.
Use Event Streams to subscribe to specific message delivery event types (this option provides the ability to select different types of message delivery events).
Less efficient and not very scalable, make a request to the /Messages endpoint to determine the final disposition of the sent message (via its unique message SID).
Best Practices for SMS Message Logging

Remove a cell number from the Twilio unsubscribe list

I have a very simple alert mechanism to alert drivers "in-the-field" when a new pickup has been assigned to them. I have had an instance twice where a driver has responded with a STOP and became un-subscribed. Once discovered we acquired the proper opt-in documentation from them. Is there any way to re-subscribe a user that opted out and changed their mind on receiving the messaging. i.e. they issued the STOP to the incorrect SMS. And have deleted the original message to START. Or do I need to code something for them to opt back in
My SendGrid provides a method to remove suppression from email but am not finding anything like that here in Twilio.
They need to send a START to the number they previously opted out of, this is currently a requirement. You will also get an error when trying to send messages to them, to alert you they opted out.
Error 21610 - Attempt to send to unsubscribed recipient

MS Teams bot events

I have a notification-only bot, and I would like to send a welcome message to users only when the bot is added to a personal conversation.
I listen to 'conversationUpdate' events as stated here, though I keep receiving the same event multiple times one after the other for the same user, all events identical (except the event ID and timestamp).
I respond to the event with HTTP status 200 (I handle them via REST).
Does anyone have an idea why I would receive the same events multiple times and how to avoid it? Is it some kind of retry due to an unexpected response on my end?
It even says here: "For personal scoped bots, your bot will only ever receive the conversationUpdate event a single time, even if the bot is removed and re-added."

How to send message in a thread using microsoft graph API?

I'm building a tool in which I need to send more than 2 messages in the same thread (the message have identical subject & recipients) using Microsoft Graph API with some interval of days between them.
The problem is that I cannot send a message in the same thread using the API, even though the subject & recipients are same, Outlook displays them as different threads (but on the recipients' side (Gmail side) - they belong to same thread).
I tried using conversationId (which I got in the first message) in the second message but they still ended up showing in different threads.
Is there any way in I can send messages in the same thread?
According to your description, I assume you want to use the https://graph.microsoft.com/v1.0/groups/{id}/threads endpoint to send more than 2 messages in the same thread.
Refer to this document,
A new conversation, conversation thread, and post are created in the group. Use reply thread or reply post to further post to that thread.
So we can use the replay endpoint to send message in the same thread.
To send emails in one thread you should use createReply method where you provide messageId of a previously sent message.
The tricky part is that after you sent a message with send or sendMail API methods, you do not have access to messageId. Even if you create a message via create method, messageId will be different after sending it.
So the solution is to send the message and find it in 'Sent Items' folder to retreive messageId. I am doing this based on time, subject and receiver. There is also useful param $top.
With correct messageId you'll be able to create reply and send it in the same thread.

Sending notification or SMS in response to an event Xcode

In Xcode I want to make an app that when a certain condition is met, it will send an SMS to a predefined contact.
I am aware this is not directly possible, but what are the alternatives to make this happen?
It should send without confirmation to a pre-defined contact you have selected and have a pre-defined message
very simple: when event happen , your handler (IBAction method) sent a message to your server (e.g. web service) to send this pre-defined message.

Resources