Waiting for multiple user entries before sending API request - api

I am currently developing an application in flutter where the user types a text, which I send through an API POST request. I'm currently able to get the text and send it and get a response, it works fine.
The thing is, I want to allow the user to write multiple messages successively, before sending the request to the API; something like that:
user types message
user presses send message
wait to see if user is typing another message before sending the API request
if user is typing, wait till he presses send, and make one API request with both messages
I don't know if that is possible to do in flutter. I read about debounce() method of different packages but i saw that it works witha delay, does it also work with checking for typing conditions?
Any help is appreciated, thanks!

Related

Maximo script to send a message to another user?

With IBM ICD/Maximo version 7.6.1.2 I am trying to inform a user when an attachment (arriving via a REST call) has finally arrived.
I have access to the USERID of the requester
the launchpoint is 'add' on DOCLINKS
I aim to inform the user using a message box (or something similar) if he/she is still active on the platform
The whole send/receive action takes more than 10-15 minutes so waiting for a response during the same REST call is not possible. The user sends a POST and later receives a POST.
The problem is, mbo.getUserInfo() points to the username of the external service and not the requester so in my opinion I need to either change the active session or active user in order to be able to use commands like:
service.webclientsession().showMessageBox(msggroup,msgkey,params)
I need a method or commands to do that.
One possible way to do this would be by sending a bulletin board message to the user to notify that their file has been uploaded as shown here

Send message to th all of bots users (telegram api)

how to send Send message to the all of bots users?
There is no way to sned message to all ?
what is the method name ?
From Official API FAQ:
How can I message all of my bot's subscribers at once?
Unfortunately, at this moment we don't have methods for sending bulk messages, e.g. notifications. We may add something along these lines in the future. (...)
Obviously, if you store users chat_id, you can send individual message to all users (I use this method).
Navid wants to send message to all subscribers via bot.
If subscribers are more than 100 persons bot will very slow to sending all messages and may doesn't send messages to all.
Navid's question was how we can send message without this problem?
you can send with curl_multi_exec
Currently, a developer would need to implement a special broadcasting function that would send the message to each active user at the time adding a small delay to avoid hitting the rate limit of 30 messages per second (see https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once). This would mean that a very popular bot with say 10K active users cannot give timely notification as the last user would get the message about 5 minutes after the first user.
Here is a feature request to ask to add a method in the Bot API to broadcast a message to all its active users at once. You can upvote this feature request. https://bugs.telegram.org/c/8463

REST API design for endpoint with notification

I am creating an API endpoint which takes a customer order, create the order and send email notification. At our current design once we successfully create the order, we send a success notification 201 to client and then make a call for our internal email api. Upon getting success notification from us the client app shows users a message to check his/her email.
I don't feel comfortable with this design because if for some reason the email sending method failed there are no way for client to understand this. On the other hand if we wait for to successfully the send the email and then send client app success notification it takes longer times.
So what is the right approach for overcoming this problem?
I think your design works. Why would the client care if the mail service is not working? If the order passes all validations on the server and is persisted I would treat that as a successful state and return 201 Created.
When the client gets 201 Created, then do what you say; give the user a message about checking their mail, but tell them that they should have some patience. Something like:
Your order was submitted. Please check your mail. If you haven't got a mail in 24 hours please contact us, "or whatever other solution here".
You have no control on what time the mail will arrive at the users mail box anyway since mail sending is not a synchronous process.
Remember: Seperate your conserns.
202 Accepted would usually be the most appropriate response for a request which requires further processing. In your case, however, this might not be right because the email is not fundamental to the resource creation.
201 Created is perfectly acceptable for you because the order has actually been created. However, as the spec says, you should return a Location header with the URI of the created resource and an entity describing how to access the resource. That should get around your issue with a mail service failure - the client can still access their order and, to be honest, e-mail is not guaranteed delivery so I'm hoping that the email isn't an absolutely required part of your business process.

MailChimp/Mandrill webhook for message created/scheduled

Is it possible to get MailChimp or Mandrill to notify a webhook URL whenever a message is either created for a list, or scheduled to be sent, along with the list and message IDs?
I have a client that wants to intercept messages from his campaign, add special data from his server, then send the resulting template through his connected Mandrill account. I'm trying to figure out how to implement the first step in this process.
Although I know this is old someone may stumble into this thread, have you checked out the webhook information?
http://help.mandrill.com/entries/58303976-Message-Event-Webhook-format
It has an easy way to implement it inside the account. You just setup a URL to intercept and parse the incoming data. I recommend first saving the data then using a scheduled task to parse the job separately so you don't lose data (although mandrill will try 100x).
If the unique id is not enough for you with your events, and you are concerned about specific campaigns you can tag the emails upon send and they will have the tagged information with the incoming event.

How can I send message to specific chatID?

I have chatId and want send messages while execute some tasks from java code. I found this explain on telegram "Bots can't initiate conversations with users. A user must either add them to a group or send them a message first. People can use telegram.me/ links or username search to find your bot." But my task works good when I use https request directly from browser. My bot perfectly answer for requests but how I can do this without user request?
I can not truly understand your case!
Anyway, your bot can send a message to a chat ID Only if the user witch blongs to the specified chat ID added your bot (send start to a bot).
and if it happened then send your message with
/sendMessage