Exchange Online (Graph API)

Microsoft Exchange Server is a mail server and calendaring server developed by Microsoft. This integration relies on EWS being enabled for the server.

Integration with LogicHub

Connecting with Exchange Online (Graph API)

To connect to Microsoft Graph following details are required:

  • Label: Connection name.
  • Reference Values: Define variables here to templatize integration connections and actions. For example, you can use https://www.{{hostname}}.com where, hostname is a variable defined in this input. For more information on how to add data, see 'Add Data' Input Type for Integrations.
  • Tenant ID: Tenant ID of the app created in Azure Active Directory.
  • Client ID: Client ID of the app created in Azure Active Directory.
  • Client Secret: Client secret of the app created in Azure Active Directory.

Actions with Exchange Online (Graph API)

List messages

Get the messages of a user via User ID or Principal Name (including the Deleted Items and Clutter folders).

Inputs to this Action

  • Connection: Choose a connection that you have created.
  • User's Principal Name or User's Unique Identifier (ID) Column Name: Jinja templated string containing user's principal name or user's unique identifier(id).
  • Mailbox Folder: Jinja templated Path & name of the folder from which to pull email messages (typically Inbox)
  • Custom OData Query: Jinja templated custom OData query to retrieve a list of messages. Refer https://docs.microsoft.com/en-us/graph/query-parameters to construct a valid OData query. e.g. $filter=subject eq '{{subject_column}}' and from/emailAddress/address eq '{{sender_email_column}}'&$top=5. (Default is no filter)
  • Mark Read: Automatically mark messages read when they are pulled by LogicHub. Possible values are True/False. (Default is False)
  • Unread Only: Pull only unread messages. Possible values are True/False. (Default is False)
  • Download Attachments: Automatically download all attachments with the mail. Possible values are True/False. (Default is False)
  • Number of Messages to be Fetched: Number of messages to be fetched. It'll override $top provided in "Custom OData query" (Default is 10 messages if it is not provided in "Custom OData query" also).

Output of Action
Return an array of JSON where each JSON representing the user.

{
   "body_html":"<html><head></head><body>....rest of the body</body></html>",
   "body":"<html><head></head><body>....rest of the body</body></html>",
   "subject":"Undeliverable: Meet for lunch?",
   "msgid":"<[email protected]od.outlook.com>",
   "date_received":"2021-03-26T04:06:24Z",
   "body_type":"html",
   "urls_probable":[
      
   ],
   "urls":[
      "https://go.microsoft.com/fwlink/?LinkId=389361"
   ],
   "recipients":[
      "[email protected]"
   ],
   "is_read":true,
   "urls_all":[
      "https://go.microsoft.com/fwlink/?LinkId=389361"
   ],
   "date_sent":"2021-03-26T04:06:23Z",
   "has_error":false,
   "error":null,
   "lhub_ts":"1616735198000",
   "from":[
      {
         "email":"[email protected].onmicrosoft.com",
         "name":"Microsoft Outlook"
      }
   ],
   "categories":[
      
   ],
   "sender":"[email protected].onmicrosoft.com",
   "body_text":"Delivery has failed to these recipients or groups:\r\n\r\[email protected] ([email protected])\r\nYour message couldn't be delivered. Despite repeated attempts to deliver your message, querying the Domain Name System (DNS) for the recip",
   "changekey":"FwAAABYAAABumxNVnY6FRKYhhP9H7JpwAAHaqjYw"
}

Send message

Send message to email addresses.

Inputs to this Action

  • Connection: Choose a connection that you have created.
  • USER'S PRINCIPAL NAME OR USER'S UNIQUE IDENTIFIER(ID) COLUMN NAME: Jinja templated string containing user's principal name or user's unique identifier(id).
  • MAIL RECIPIENTS: Jinja templated comma separated email ids.
  • MAIL SUBJECT: Jinja templated string containing the mail subject.
  • TYPE: Select type of email body. Possible values are Plain Text / HTML. (Default is Plain Text)
  • MAIL BODY: Jinja templated string containing the mail body.
  • CC ON OUTBOUND E-MAIL: Jinja templated comma separated email ids, which would be added to cc of the email.
  • ATTACHMENT: Column containing one or more file IDs to attachment. (Can be a comma separated string of lhub_file_id values or a json dict in the format of {"<lhub_id>":"<file_name>"}).
  • ATTACHMENT FILE EXTENSION: If no file name is provided, add this extension to attached files.

Output of Action

  • recipients: Array of emails to which mail is sent
  • date_sent: Date in UTC
  • msg: Success message
  • cc: Array of cc added. If no email is added in cc, then this remains empty array.
  • attachments: Array of attachments added. If no attachment added, then this remains empty array.
{
   "recipients":[
      "[email protected]"
   ],
   "date_sent":"2021-03-26 06:21:42 UTC",
   "msg":"E-mail sent successfully",
   "cc":[
      
   ],
   "attachments":[
      
   ]
}

Did this page help you?