Check Directory for files after FTP operation - intersystems-ensemble

I currently have two custom business operation scripts that detect whether a file or files have been ftped. If the job was successful an email is sent.
I am looking to check if the directory is empty and if so send an email letting the user know that no files were found.
I am thinking that it would be done on the inbound service but can't quite figure out the code.

If you just want to send a notification (email) for an empty directory (through ftp), you can do it without any code from an inbound service by setting the Alerting Control parameters :
Alert on Error ( AlertOnError ) = true
Inactivity Timeout ( InactivityTimeout ) = number of seconds before raising the alert
NB: additionally, if not already existing, you'll need to add the Ens.Alert component, generally a simple business process router (ie: EnsLib.MsgRouter.RoutingEngine) which will receive the Alert Message and route it to the appropriate business operation in charge of sending the alert via email (ie: EnsLib.EMail.AlertOperation or a similar email operation).

Related

how to differentiate Sent and Received messages in graph API?

I'm working with mailbox messages using Graph API. How to classify the messages as sent or received?
I found the similar query,Is there a way to differentiate an inbound (received) versus outbound (sent) email/message?
Thank you
You can try the following steps and see if this helps your scenario:
Get the mail folder collection directly under the root folder of the signed-in user. The returned collection includes any mail search folders directly under the root.
GET /me/mailFolders
Get messages in a specific folder in the user's mailbox - Use list messages endpoint for this.
GET /me/mailFolders/{id}/messages
Can you try the below queries and see if this helps your scenario:
To identify sent message - https://graph.microsoft.com/v1.0/me/messages?$filter=sender/emailAddress/address eq 'your mail address'
To identify received message - https://graph.microsoft.com/v1.0/me/messages?$filter=sender/emailAddress/address ne 'your email address'

Exchange Web Services - sending email error "item is out of date"

I have code which sends email via EWS (it has to read incoming email and move messages, so sending via EWS instead of SMTP makes some sense). 95% of the time it works, but occasionally I get an error saying:
"The operation can't be performed because the item is out of date. Reload the item and try again."
I already am saving the email in the Sent Items folder and then calling Bind() to reload the message before trying to send. Any insights into what is going on and why? Also, how to avoid or recover since Bind() isn't reloading the message?
I already am saving the email in the Sent Items folder and then calling Bind() to reload the message before trying to send
Why are you saving it to the Sentitems folder before sending? its better to use drafts folder as a number of different things maybe syncing against the other folders (including the substrate processes in Office365). It sounds like the changekey is out of date probably because another process has made a changed to the Sent Message.

Unable to get timestamp of the message posted by Slack App

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.

Difference between Sash Command and Out going webhook

I know following about slack slash commands and out going webhooks
1) Slash Commands:
- When user types slash command, it Will trigger external URL (URL of external web service), with all required data and message
- Web service would process that as required, and would respond with HTTP Response.
2) Outgoing webhook:
- When user sends message with triggering words(optional) in specified channel, it will trigger external URL (URL of external web service), with all required data and message
- Web service would process that as required, and would respond with HTTP Response
Purpose of both these functionalities is same. Only difference I can see is - with slash command, there is no way to define triggering criteria. If this command is used, external URL is called irrespective of channel and words in the message. While with outgoing webhook, we can apply filters(matching criteria) to call external URL conditionally, whenever criteria matches.
Is there any other difference?
When should we use slash command over outgoing webhook and vice versa?
I want to listen to a particular channel, and sends its data to google sheet when they type "OOO, away, late".
I can create 3 slash commands or can create a outgoing webhook for these three triggering words for this channel.
What is the best approach to accomplish this? I think I should go with out going webhook, considering its capability of matching criteria.
The main difference is how they are triggered.
A slash command is only triggered when a user enters its specific command into a channel, e.g. /who to see members of a channel.
The outgoing webhook automatically sends all message of a channel to a web service or all messages that include a specific trigger word.
However, I would strongly recommend to use Slack events instead of outgoing webhooks for your use case, since the latter is marked as legacy integration. Also events are way more powerful, e.g. they also work in private channels.

Changing the sender of a Dynamics CRM e-mail in a plugin?

So, here's my situation. We have a department that needs the ability to use queues in CRM 4. They also need the ability to reply to e-mails that come to that queue from their department e-mail address. (So that any customer responses will go back to the queue to be handled by agents)
I originally was going to build a JavaScript customization that inserted a checkbox that said "Send From Business Unit". Toggling this would look up their department user based on the e-mail address on the Business Unit. I successfully got this working (as a concept), but found that actually sending triggers the dreaded "CrmCheckPrivilege failed."
Which is good, because that means CRM is actually enforcing security.
So my problem? I have no idea how to replicate this functionality and it's a must have for this customer group. Is there anyway to modify the e-mail after it's already gone through security checks via a plugin? Perhaps a pre-stage send plugin?
I want to be reasonably certain of success before I commit a lot of time to this solution. I'm also open to any other ideas too.
Thanks in advance,
Clif
Well, first, a "CrmPrivilegeCheck failed" can always be fixed by adjusting the user's roles and giving him the appropriate privilege (the privilegeId is always returned in the exception but may not be shown in the particular error dialog you are getting) and level, but this may not be wanted by the department.
A solution we have used is just slightly different from yours: Do not send the mails through another user, but through the queue. Queues can also be eMail senders in MSCRM. The queues should already have the correct eMail addresses set in order to work properly with the eMail router. Set up a way to determine the correct queue (like a field on the systemuser entity or a hardcoded queue name in your JavaScript) and set the from lookup accordingly in your JavaScript. That way the eMails will be sent using the name and address of the queue, so any direct replies will always have that queue as the recipient.

Resources