Maximo script to send a message to another user? - jython

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

Related

Waiting for multiple user entries before sending API request

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!

Twilio integration

I am using twilio from salesforce (On a custom object) to call some numbers. Is there any way to send voicemails to those numbers without ringing there phone or with ring as least as possible .
Will appreciate your help .
Thanks!
Twilio developer evangelist here.
The voicemail of someone else's phone is not under control by Twilio. So you can't directly leave a voicemail without ringing them. You also cannot control the number of rings someone else's phone will make before going to voicemail.
Using Twilio, you could make calls to the numbers and play a message when they or their voicemail answers. This would either directly deliver the message to the user or record it on their voicemail.
[edit]:
After the discussion in comments below, here is an updated answer.
I'll give an overview of the system I think you need to build. I can't be more specific, because I have little details of your system or what you've tried.
I think you need to build in Twilio Client to your Salesforce application. You can watch a video on how to integrate Twilio Client with Salesforce.
You can use this to generate the calls to your customers and speak to them from within Salesforce.
To add to this, you also want to leave a message if you get a voicemail. You will need to do a few things to achieve this.
First, you will need to store the Call Sid of the call you made in the browser. You can get this from the parameters attribute of the Twilio.Connection.
You will need to add a button to your interface that is active when you are on an active call. This button needs to hook up to an endpoint in your Salesforce app. The button should send the Call Sid you saved from your connection to the app.
Within the Salesforce app, you will need to build the endpoint for the above. This will receive the Call Sid as an argument. This Call Sid is the parent call and represents your connection to the call. We need to get the Child Call, which is the other end. We do this by calling on the Calls resource passing the Call Sid as the ParentCallSid parameter. This will get you access to the child call.
You now need to redirect the child call using the REST API to another endpoint that has the TwiML to <Play> your recorded message for voicemail.
Then, when your user is on a call and it goes to voicemail, they should press the button in the interface. This will redirect the child call away and consequently hang up on the user in salesforce.
Let me know if this helps at all.

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.

How to push something to user in a rest API?

We already have a system in place that uses Restful APIs in order to send let's say SMS. All of our clients are using our server to send their requests to Rest API so we drop connections except our server IP to handle authentication.
Now policy has been changed. We want to expose our APIs to the outside world. We now want to be able to push to user under specific circumstances. Let's say that I want to send a delivery report to the user when SMS has been delivered. Or when something has been scheduled for a specific time, when that time arrives user get notified.
How to handle these notifs? Has anyone used the same or similar approach?
Assuming you can reach your clients back via HTTP. The model to do this is to use callbacks. When someone posts a scheduled job on your server, they should also post a callback URI where your server can notify when the job is complete.
Sample below:
https://schedulingSevrer.com/runSchedule?callback=http://clientserver.com/reportStatusHere
So when the job is done your callback will be like
http://clientserver.com/reportStatusHere?jobId=12345&status=complete
Or if your clients are mobile apps on Andorid you can use the Google Push notifications.

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.