Logic Twitter



-->

  1. Logic Rapper
  2. Logic Twitter
  3. Sumo Logic Twitter
  4. Logic Rapper Twitter
  5. Logic Twitter Bobby Tarantino

In Azure Logic Apps, connectors help you quickly access data, events, and other resources from other apps, services, systems, protocols, and platforms. When you use connectors, you can build logic app workflows that use, process, and integrate information across cloud-based, on-premises, and hybrid environments - often without having to write any code.

You can choose from hundreds of connectors to use in your workflows. As a result, this documentation focuses on some popular and commonly used connectors for Logic Apps. For complete information about connectors across Logic Apps, Microsoft Power Automate, and Microsoft Power Apps, review the Connectors documentation. For information on pricing, review the Logic Apps pricing model, and Logic Apps pricing details.

The latest tweets from @TerrariaLogic. The latest tweets from @AutomationLogic.

Note

To integrate your workflow with a service or API that doesn't have a connector, you can either callthe service over a protocol, such as HTTP, or create a custom connector.

What are connectors?

Connectors provide triggers and actions that you use to perform tasks in your logic app's workflow. Each trigger and action has properties that you can configure. Some triggers and actions require that you create and configure connections so that your workflow can access a specific service or system.

Triggers

A trigger specifies the event that starts the workflow and is always the first step in any workflow. Each trigger also follows a specific firing pattern that controls how the trigger monitors and responds to events. Usually, a trigger follows the polling pattern or push pattern, but sometimes, a trigger is available in both versions.

  • Polling triggers regularly check a specific service or system on a specified schedule to check for new data or a specific event. If new data is available, or the specific event happens, these triggers create and run a new instance of your workflow. This new instance can then use the data that's passed as input.
  • Push triggers listen for new data or for an event to happen, without polling. When new data is available, or when the event happens, these triggers create and run a new instance of your workflow. This new instance can then use the data that's passed as input.
Logic

For example, you might want to build a workflow that does something when a file is uploaded to your FTP server. As the first step in your workflow, you can use the FTP trigger named When a file is added or modified, which follows the polling pattern. You can then specify a schedule to regularly check for upload events.

A trigger also passes along any inputs and other required data into your workflow where later actions can reference and use that data throughout the workflow. For example, suppose you want to use Office 365 Outlook trigger named When a new email arrives to start a workflow when you get a new email. You can configure this trigger to pass along the content from each new email, such as the sender, subject line, body, attachments, and so on. Your workflow can then process that information by using other actions.

Actions

An action is an operation that follows the trigger and performs some kind of task in your workflow. You can use multiple actions in your workflow. For example, you might start the workflow with a SQL trigger that detects new customer data in a SQL database. Following the trigger, your workflow can have a SQL action that gets the customer data. Following the SQL action, your workflow can have another action, not necessarily SQL, that processes the data.

Connector categories

In Logic Apps, most triggers and actions are available in either a built-in version or managed connector version. A small number of triggers and actions are available in both versions. The versions available depend on whether you create a multi-tenant logic app or a single-tenant logic app, which is currently available only in Logic Apps Preview.

Built-in triggers and actions run natively on the Logic Apps runtime, don't require creating connections, and perform these kinds of tasks:

  • Run code in your workflows.
  • Organize and control your data.
  • Manage or manipulate data.

Managed connectors are deployed, hosted, and managed by Microsoft. These connectors provide triggers and actions for cloud services, on-premises systems, or both. Managed connectors are available in these categories:

  • On-premises connectors that help you access data and resources in on-premises systems.
  • Enterprise connectors that provide access to enterprise systems.
  • Integration account connectors that support business-to-business (B2B) communication scenarios.
  • Integration service environment (ISE) connectors that are a small group of managed connectors available only for ISEs.

Connection configuration

Most connectors require that you first create a connection to the target service or system before you can use its triggers or actions in your workflow. To create a connection, you have to authenticate your identity with account credentials and sometimes other connection information. For example, before your workflow can access and work with your Office 365 Outlook email account, you must authorize a connection to that account.

Connection security and encryption

For connectors that use Azure Active Directory (Azure AD) OAuth, such as Office 365, Salesforce, or GitHub, you must sign into the service where your access token is encrypted and securely stored in an Azure secret. Other connectors, such as FTP and SQL, require a connection that has configuration details, such as the server address, username, and password. These connection configuration details are also encrypted and securely stored in Azure.

Established connections can access the target service or system for as long as that service or system allows. For services that use Azure AD OAuth connections, such as Office 365 and Dynamics, the Logic Apps service refreshes access tokens indefinitely. Other services might have limits on how long Logic Apps can use a token without refreshing. Some actions, such as changing your password, invalidate all access tokens.

Although you create connections from within a workflow, connections are separate Azure resources with their own resource definitions. To review these connection resource definitions, download your logic app from Azure into Visual Studio. This method is the easiest way to create a valid, parameterized logic app template that's mostly ready for deployment.

Tip

If your organization doesn't permit you to access specific resources through Logic Apps connectors, you can block the capability to create such connections using Azure Policy.

Firewall access for connections

If you use a firewall that limits traffic, and your logic app workflows need to communicate through that firewall, you have to set up your firewall to allow access for both the inbound and outbound IP addresses used by the Logic Apps service or runtime in the Azure region where your logic app workflows exist. If your workflows also use managed connectors, such as the Office 365 Outlook connector or SQL connector, or use custom connectors, your firewall also needs to allow access for all the managed connector outbound IP addresses in your logic app's Azure region. For more information, review Firewall configuration.

Recurrence behavior

Recurring built-in triggers, such as the Recurrence trigger, run natively on the Logic Apps runtime and differ from recurring connection-based triggers, such as the Office 365 Outlook connector trigger where you need to create a connection first.

For both kinds of triggers, if a recurrence doesn't specify a specific start date and time, the first recurrence runs immediately when you save or deploy the logic app, despite your trigger's recurrence setup. To avoid this behavior, provide a start date and time for when you want the first recurrence to run.

Recurrence for built-in triggers

Recurring built-in triggers follow the schedule that you set, including any specified time zone. However, if a recurrence doesn't specify other advanced scheduling options, such as specific times to run future recurrences, those recurrences are based on the last trigger execution. As a result, the start times for those recurrences might drift due to factors such as latency during storage calls.

For more information, review the following documentation:

Recurrence for connection-based triggers

In recurring connection-based triggers, such as Office 365 Outlook, the schedule isn't the only driver that controls execution. The time zone only determines the initial start time. Subsequent runs depend on the recurrence schedule, the last trigger execution, and other factors that might cause run times to drift or produce unexpected behavior, for example:

Logic Twitter
  • Whether the trigger accesses a server that has more data, which the trigger immediately tries to fetch.
  • Any failures or retries that the trigger incurs.
  • Latency during storage calls.
  • Not maintaining the specified schedule when daylight saving time (DST) starts and ends.
  • Other factors that can affect when the next run time happens.

For more information, review the following documentation:

Troubleshooting recurrence issues

To make sure that your workflow runs at your specified start time and doesn't miss a recurrence, especially when the frequency is in days or longer, try the following solutions:

  • When DST takes effect, manually adjust the recurrence so that your workflow continues to run at the expected time. Otherwise, the start time shifts one hour forward when DST starts and one hour backward when DST ends. For more information and examples, review Recurrence for daylight saving time and standard time.

  • If you're using a Recurrence trigger, specify a time zone, a start date and time. In addition, configure specific times to run subsequent recurrences in the properties At these hours and At these minutes, which are available only for the Day and Week frequencies. However, some time windows might still cause problems when the time shifts.

  • Consider using a Sliding Window trigger instead of a Recurrence trigger to avoid missed recurrences.

Logic Rapper

Custom APIs and connectors

To call APIs that run custom code or aren't available as connectors, you can extend the Logic Apps platform by creating custom API Apps. You can also create custom connectors for any REST or SOAP-based APIs, which make those APIs available to any logic app in your Azure subscription. To make custom API Apps or connectors public for anyone to use in Azure, you can submit connectors for Microsoft certification.

ISE and connectors

For workflows that need direct access to resources in an Azure virtual network, you can create a dedicated integration service environment (ISE) where you can build, deploy, and run your workflows on dedicated resources. For more information about creating ISEs, review Connect to Azure virtual networks from Azure Logic Apps.

Custom connectors created within an ISE don't work with the on-premises data gateway. However, these connectors can directly access on-premises data sources that are connected to an Azure virtual network hosting the ISE. So, logic apps in an ISE most likely don't need the data gateway when communicating with those resources. If you have custom connectors that you created outside an ISE that require the on-premises data gateway, logic apps in an ISE can use those connectors.

In the Logic Apps Designer, when you browse the built-in triggers and actions or managed connectors that you want to use for logic apps in an ISE, the CORE label appears on built-in triggers and actions, while the ISE label appears on managed connectors that are specifically designed to work with an ISE.


CORE
Built-in triggers and actions with this label run in the same ISE as your logic apps.


ISE
Managed connectors with this label run in the same ISE as your logic apps.
If you have an on-premises system that's connected to an Azure virtual network, an ISE lets your workflows directly access that system without using the on-premises data gateway. Instead, you can either use that system's ISE connector if available, an HTTP action, or a custom connector.
For on-premises systems that don't have ISE connectors, use the on-premises data gateway. To find available ISE connectors, review ISE connectors.


No label
All other connectors without a label, which you can continue to use, run in the global, multi-tenant Logic Apps service.

Known issues

The following table includes known issues for Logic Apps connectors.

Error messageDescriptionResolution
Error: BadGateway. Client request id: '{GUID}'This error results from updating the tags on a logic app where one or more connections don't support Azure Active Directory (Azure AD) OAuth authentication, such as SFTP ad SQL, breaking those connections.To prevent this behavior, avoid updating those tags.

Next steps

-->

A tutorial for using Azure Logic Apps to monitor recent tweets on Twitter. The app sends an email notification to subscribers when new tweets are posted matching a search term.

Technologies Used

  • Azure Logic Apps - Manage subscriptions, monitor tweets, and send email notifications to subscribers
  • Azure Table Storage - Store persistent data like subscriptions

Prerequisites

  • An Azure subscription
    • If you don't have one, sign up for free.
    • If you're a student, you can sign up for free without requiring a credit card at sign-up.
  • An email account (Office 365 or Outlook for all features, Gmail if approval emails are not required)
  • A Twitter account
  • A web browser
  • Azure Storage Explorer (optional, but recommended for working with Azure Table Storage)

Create Azure resources

Logics Apps allow you to build and test your application entirely from the Azure Portal using the Logic Apps Designer. Let's get started by creating a few Logic Apps and a storage account.

Sign in to the Azure portal

  1. Go to the Azure portal and sign in with your Azure account credentials.

    See Prerequisites for sign up links if you don't have an account

Create a Logic App to manage subscribers

  1. From the main Azure menu, choose Create a resource > Web > Logic App.

  2. Provide details about your Logic App as shown here.After you're done, choose Create.

    PropertyValueDescription
    NameTwitterSubscriptionManagerThe name for your Logic App
    Subscription<your-Azure-subscription-name>The name for your Azure subscription
    Resource groupCreate new > TwitterLogicAppSampleThe name for the Azure resource group used to organize related resources
    LocationEast USThe region where your Logic App is hosted
    Log AnalyticsOffKeep the Off setting for diagnostic logging.

Create a Logic App to monitor tweets and send notifications to subscribers

  1. From the main Azure menu, choose Create a resource > Web > Logic App.

  2. Provide details about your Logic App as shown here.After you're done, choose Create.

    PropertyValueDescription
    NameTwitterNotifierThe name for your Logic App
    Subscription<your-Azure-subscription-name>The name for your Azure subscription
    Resource groupUse existing > TwitterLogicAppSampleUse the same resource group as the Logic App
    LocationEast USThe region where your Logic App is hosted
    Log AnalyticsOffKeep the Off setting for diagnostic logging.

Create a Storage Account

  1. From the main Azure menu, choose Create a resource > Storage > Storage account - blob, file, table, queue.

  2. Provide details about your Storage Account as shown here.After you're done, choose Create.

    PropertyValueDescription
    Name<your-name>twitterdataThe name for your Storage Account
    Deployment modelResource managerUse Resource Manager for new applications and for the latest Azure features
    Account kindStorage (general purpose v1)The type of storage account. V1 has everything we need but you can use V2 if you like.
    LocationEast USThe region where your app's data is hosted
    ReplicationLocally-redundant storage (LRS)The least durable but lowest cost storage
    PerformanceStandardStandard storage accounts are backed by magnetic drives and provide the lowest cost per GB
    Secure transfer requiredEnabledThere's no reason not to use HTTPS
    Subscription<your-Azure-subscription-name>The name for your Azure subscription
    Resource groupUse existing > TwitterLogicAppSampleUse the same resource group as the Logic App
    Log AnalyticsOffKeep the Off setting for diagnostic logging.

Create a table in the storage account

Azure Table Storage will be used to persist data about subscribers and tweets between executions of the Logic App.

  1. From the main Azure menu, choose Resource groups > TwitterLogicAppSample.

  2. Choose the <your-name>twitterdata Storage Account that was created earlier.

  3. The storage account overview will open. Under Services choose Tables.

  4. Click the + Table button at the top to add a new table named subscriptions and choose OK.

Configure the TwitterSubscriptionManager Logic App

Logic

This Logic App will accept subscribe and unsubscribe requests from users to/from a Twitter search term of their choosing. It will also verify the request was intentional by sending a verification email to the user prior to honoring their request.

Configure the trigger for the TwitterSubscriptionManager Logic App

Every Logic App must start with a trigger, which fires when a specific event happens or when a specific condition is met. Each time the trigger fires, the Logic Apps engine creates a Logic App instance that starts and runs your workflow.

Logic Twitter

  1. From the main Azure menu, choose Resource groups > TwitterLogicAppSample.

  2. Choose the TwitterSubscriptionManager Logic App that was created earlier.

  3. The Logic Apps Designer will open and show a page with an introduction video and commonly used triggers. Under Start with a common trigger, choose When a HTTP request is received.

  4. Use the Save button at the top of the screen to save the Logic App. Notice that a unique URL to trigger your Logic App was populated in the HTTP POST URL box. Your Logic App workflow will be triggered when a POST request is received at this URL.

Configure the parameters for the HTTP trigger

Your Logic App will need some information from the user to subscribe/unsubscribe them to/from a Twitter search term or hashtag. Namely, we'll need the email address of the subscriber, the search term, and whether the request is to subscribe or unsubscribe.

  1. In the When a HTTP request is received trigger, click the Edit link next to Using the default values for the parameters. In the box that appears, we'll provide a JSON schema of the request format our Logic App should expect.

    1. Under the Request Body JSON Schema box, click the Use sample payload to generate schema link.
    2. In the Enter or paste a sample JSON payload dialog, paste the JSON below.
    3. Choose Done.
  2. Save the Logic App.

Send an approval email to validate the request

  1. Choose + New step in the Logic Apps Designer.

  2. Under Choose an action, enter 'send approval email' as your filter. From the actions list, select the Send approval email action for the email provider that you want.

    1. To filter the actions list to a specific app or service, you can select that app or service first:
      • For personal Microsoft accounts, select Outlook.com.
      • For Office 365 work or school accounts, select Office 365 Outlook.

      The Gmail service does not support sending approval emails. If you only have a Gmail account, you can still use the Send an email action but your Logic App will not be able to receive responses to the email.

  3. If asked for credentials, sign in to your email account so that Logic Apps can create a connection to your email account.

  4. In the Send approval email action, specify the data that you want the email to include.

    1. Click inside the To box. The dynamic content dialog will appear. Choose email from the Dynamic content tab under the When a HTTP request is received heading. This will use the email address provided in the body of the HTTP request that triggered the workflow.
    2. If you like, edit the Subject of the email. You can include other parameters from the HTTP request using the dynamic content dialog. For example, you may want to change the subject to 'Please approve <action> request for notifications about <term> tweets' where the <action> and <term> strings are replaced with the parameter values from the HTTP request.
  5. Save the Logic App.

Check if the request was approved

After the approval email is sent, the Logic App will wait for the user to click either the 'Approve' or 'Reject' link in the email. Once the user clicks one of those links, the Logic App will need to determine what to do next based on the response.

  1. Choose + New step in the Logic Apps Designer.

  2. Under Choose an action, enter 'condition' as your filter. From the actions list, choose the Condition Control action.

  3. In the Condition action, populate the tree of conditions to evaluate.

    1. Leave the And drop down as is.
    2. Click inside the Choose a value box. The dynamic content dialog will appear. Choose SelectedOption from the Dynamic content tab under the Send approval email heading.
    3. Leave the value of the is equal to condition unchanged.
    4. In the Choose a value box, enter Approve.
  4. Save the Logic App.

Check if the request was for subscribing or unsubscribing

Once the request is approved the Logic App will need to perform the requested action (subscribe or unsubscribe the user). In this step, we'll determine which action to perform.

  1. Choose Add an action within the If true block below the Condition in the Logic Apps Designer.

  2. Under Choose an action, enter 'switch' as your filter. From the actions list, choose the Switch Control action.

  3. In the Switch action, populate the On value to tell the control action what value should be used to determine the next step.

    1. Click inside the On box. The dynamic content dialog will appear. Choose action from the Dynamic content tab under the When a HTTP request is received heading.
  4. Below the Switch action, locate the Case block. Populate the Equals box with the text subscribe.

  5. Click the (+) button between the Case block and the Default block. A Case 2 block will be added.

  6. Inside the Case 2 block, populate the Equals box with the text unsubscribe.

    If you like, you can rename these case blocks using the Rename option within the ยทยทยท menu of each block.

  7. Save the Logic App.

Add an entry to the subscriptions table if the request was to subscribe

  1. Choose Add an action within the Case block containing 'Equals subscribe.'

  2. Under Choose an action, enter 'insert or replace' as your filter. From the actions list, choose the Insert or Replace Entity Azure Table Storage action.

  3. In the Insert or Replace Entity action, specify the table and the entity to insert or replace.

    1. You may be prompted for a Storage Account connection

      1. In the Connection Name box, provide a name like TwitterLogicAppStorage.
      2. Choose the Storage Account created earlier, <your-name>twitterdata.
      3. Click Create.
    2. Once the connection is created, choose subscriptions from the Table drop down.

    3. Click inside the Partition Key box. The dynamic content dialog will appear. Switch to the Expression tab and enter uriComponent(toLower(triggerBody()['email'])) into the expression box. Click OK to set the expression as the partition key value.

      This expression converts the email field from the POST request to lower case and then URI-encodes it. Converting to lower case will ensure that the user can unsubscribe easily later without the need to use the exact casing as when they subscribed. The encoding is necessary in case the user enters a character that is not permitted in partition keys or row keys, such as #.

    4. Click inside the Row Key box. The dynamic content dialog will appear. Switch to the Expression tab and enter uriComponent(toLower(triggerBody()['term'])) into the expression box. Click OK to set the expression as the row key value.

    5. In the Entity box, enter the JSON below.

      The LastTweetId property will be used to track the most recent tweet our Logic App found that matches the provided search term. It will simplify determining which tweets are 'new' later.

  4. Save the Logic App.

    You can read more about partition keys, row keys, and Azure Table Storage in general here.

Remove an entry from the subscriptions table if the request was to unsubscribe

  1. Choose Add an action within the Case 2 block containing 'Equals unsubscribe.'

  2. Under Choose an action, enter 'delete entity' as your filter. From the actions list, choose the Delete Entity Azure Table Storage action.

  3. In the Delete Entity action, specify the table and the entity to delete.

    1. Choose subscriptions from the Table drop down.
    2. Click inside the Partition Key box. The dynamic content dialog will appear. Switch to the Expression tab and enter uriComponent(toLower(triggerBody()['email'])) into the expression box. Click OK to set the expression as the partition key value.
    3. Click inside the Row Key box. The dynamic content dialog will appear. Switch to the Expression tab and enter uriComponent(toLower(triggerBody()['term'])) into the expression box. Click OK to set the expression as the row key value.
    4. Leave the ETag box empty.
  4. Save the Logic App.

Test out the TwitterSubscriptionManager Logic App

Congratulations! The Logic App should now be ready for use. Let's test it out!

  1. Save any outstanding changes made to the Logic App using the Save button at the top of the Logic Apps Designer.

  2. Click the When a HTTP request is received trigger to expand it. Copy the value of the HTTP POST URL using the Copy URL button. Store this for later use.

  3. Make a HTTP POST request to the URL copied in the last step.

    • On Windows, this can be done using a PowerShell command like this:
    • On Mac/Linux/Windows Subsystem for Linux, this can be done using a cURL command like this:
  4. Close the Logic Apps Designer using the X in the top right corner of the blade.

  5. Choose Refresh at the top of the Logic App overview blade.

  6. Under the Run history section of the Logic App overview blade, find the most recent run of the Logic App. Click its row to view a visualization of the executed workflow.

  7. Optionally, use Azure Storage Explorer to browse to the <your-name>twitterdata Storage Account and verify an entity was added to the subscriptions table.

Configure the TwitterNotifier Logic App

This Logic App will periodically query tweets from a Twitter search API based on the subscriptions in the Azure Table and inform subscribers of new tweets via email.

Configure the trigger for the TwitterNotifier Logic App

This Logic App's trigger will be a recurrence, meaning the Logic App will execute itself automatically based on a configurable time interval.

  1. From the main Azure menu, choose Resource groups > TwitterLogicAppSample.

  2. Choose the TwitterNotifier Logic App that was created earlier.

  3. The Logic Apps Designer will open and show a pagewith an introduction video and commonly used triggers. Under Start with a common trigger, choose Recurrence.

  4. Keep the default recurrence frequency or update it if you like.

  5. Use the Save button at the top of the screen to save the Logic App. If you chose a frequent interval for the Logic App, you may wish to return to the Logic App's overview blade and disable the Logic App until it is complete.

Read subscriptions from the Table Storage

  1. Choose + New step in the Logic Apps Designer.

  2. Under Choose an action, enter 'get entities' as your filter. From the actions list, select the Get entities Azure Table Storage action.

  3. In the Get entities action, specify the details of subscriptions table created earlier.

    1. You may be prompted for a Storage Account connection
      1. In the Connection Name box, provide a name like TwitterLogicAppStorage.
      2. Choose the Storage Account created earlier, <your-name>twitterdata.
      3. Click Create.
    2. Once the connection is created, choose subscriptions from the Table drop down.
  4. Save the Logic App.

Select the subscription details from the entities

Next well map each Table Storage entity to an object with more convenient property names and URI-decoded versions of the partition key and row key.

  1. Choose + New step in the Logic Apps Designer.

  2. Under Choose an action, enter 'select' as your filter. From the actions list, choose the Select Data Operations action.

  3. In the Select action, specify the properties to select from the table entities.

    1. Click inside the From box. The dynamic content dialog will appear. Choose Get entities result List of Entities from the Dynamic content tab.

    2. In the Map fields, enter the following mappings

      KeyValueDetails
      Email EncodedGet entities result An entity Partition KeyChoose this value from the Dynamic content tab
      Search Term EncodedGet entities result An entity Row KeyChoose this value from the Dynamic content tab
      EmailuriComponentToString(item()['PartitionKey'])Enter this value into the Expression tab of the Dynamic content dialog
      Search TermuriComponentToString(item()['RowKey'])Enter this value into the Expression tab of the Dynamic content dialog
      Last Tweet IDitem()['LastTweetId']Enter this value into the Expression tab of the Dynamic content dialog

      The item() portion of the expression is a function that returns the item that is in the current iteration of a repeating action. It may be helpful to think of this as the element at the current index of a loop over an array.

  4. Save the Logic App.

Create a loop to iterate through the subscription objects

  1. Choose + New step in the Logic Apps Designer.

  2. Under Choose an action, enter 'for each' as your filter. From the actions list, choose the For each Control action.

  3. In the For each action, specify the output of the Select action as the value for the Select an output from previous steps box. Click within the box and choose Output under the Select step header of the Dynamic content tab.

  4. Save the Logic App.

Get recent tweets from the Twitter 'Search tweets' API

Twitter offers an API that provides the most recent tweets matching a search term (word, phrase, or hashtag). We'll query that API for each subscribed search term within our Logic App. The API is available as a Microsoft Connector. A connector is a proxy or a wrapper around an API that allows the underlying service to talk to Microsoft Flow, PowerApps, and Logic Apps. You can read more about the Twitter Connector here.

  1. Choose Add an action within the For each loop in the Logic Apps Designer.

  2. Under Choose an action, enter 'search tweets' as your filter. From the actions list, choose the Search tweets Twitter action.

  3. If asked for credentials, sign in to your Twitter account so that Logic Apps can create a connection and call the Twitter API.

  4. In the Search tweets action, specify the properties of the API request.

    1. Click within the Search text box. The dynamic content dialog will appear. Switch to the Expression tab and enter item()['Search Term'] into the expression box. Click OK to save the expression.
    2. Click the Show advanced options link within the Search tweets action.
    3. If you wish, increase the Maximum results to 100.
    4. Click within the sinceId box. The dynamic content dialog will appear. Switch to the Expression tab and enter item()['Last Tweet ID'] into the expression box. Click OK to save the expression.

      This will ask the Twitter API to only return tweets that were created after the specified tweet ID.

  5. Save the Logic App.

Check if there are new tweets matching the search term

We want to check if any new tweets matching the search term have been posted since the last time our Logic App executed. Since we asked the Twitter API to only return tweets since the last tweet ID our Logic App encountered, we can check the number of tweets returned by the API to determine if we should notify the subscriber of new tweets.

  1. Choose Add an action within the For each loop in the Logic Apps Designer.

  2. Under Choose an action, enter 'condition' as your filter. From the actions list, choose the Condition Control action.

  3. In the Condition action, populate the tree of conditions to evaluate.

    1. Leave the And drop down as is.
    2. Click inside the first Choose a value box. The dynamic content dialog will appear. Switch to the Expression tab and enter length(body('Search_tweets')) into the expression box. Click OK to save the expression.

      This expression will return the number of tweets in the body of the Twitter API response.

    3. Change the value of the is equal to condition to is greater than.
    4. In the Choose a value box, enter 0.
  4. Save the Logic App.

Sumo Logic Twitter

Update the Last Tweet ID for the subscription in Azure Table Storage

  1. Choose Add an action within the If true block below the Condition in the Logic Apps Designer.

  2. Under Choose an action, enter 'merge entity' as your filter. From the actions list, choose the Merge Entity Azure Table Storage action.

  3. In the Merge Entity action, specify the table entity to update.

    1. In the Table box, choose subscriptions from the drop down.
    2. Click inside the Partition Key box. The dynamic content dialog will appear. Switch to the Expression tab and enter item()['Email Encoded'] into the expression box. Click OK to save the expression.
    3. Click inside the Row Key box. The dynamic content dialog will appear. Switch to the Expression tab and enter item()['Search Term Encoded'] into the expression box. Click OK to save the expression.
    4. In the Entity box, enter the JSON template below.
      1. After populating the field, highlight the <id> portion of the field's value and delete it.
      2. With your cursor at the position where <id> used to be, click the Expression tab in the Dynamic content dialog.
      3. In the expression box, enter first(body('Search_tweets'))['TweetId'] and choose OK. This will update the ID of the most recent tweet in the table entity.
    5. In the ETag box, enter *. This will update the table entity regardless of whether it has changed since we queried it.
  4. Save the Logic App.

Send a notification email if there are new tweets matching the subscribed term

Logic Rapper Twitter

  1. Choose Add an action within the If true block below the Merge Entity action in the Logic Apps Designer.

  2. Under Choose an action, enter 'send an email' as your filter. From the actions list, select the Send an email action for the email provider that you want.

    1. To filter the actions list to a specific app or service, you can select that app or service first:
      • For personal Microsoft accounts, select Outlook.com.
      • For Office 365 work or school accounts, select Office 365 Outlook.
      • For personal Google accounts, select Gmail.
  3. If asked for credentials, sign in to your email account so that Logic Apps can create a connection to your email account.

  4. In the Send an email action, specify the data that you want the email to include.

    1. Click inside the To box. The dynamic content dialog will appear. Switch to the Expression tab and enter item()['Email'] into the expression box. Click OK to save the expression.
    2. In the Subject box, enter the value <number> new tweets matching <term>.
      1. After populating the field, highlight the <number> portion of the field's value and delete it.
      2. With your cursor at the position where <number> used to be, click the Expression tab in the Dynamic content dialog.
      3. In the expression box, enter length(body('Search_tweets')) and choose OK. This will insert the number of new tweets into the subject at the correct position.
      4. Now highlight the <term> portion of the field's value and delete it.
      5. With your cursor at the position where <term> used to be, click the Expression tab in the Dynamic content dialog.
      6. In the expression box, enter item()['Search Term'] and choose OK. This will insert the subscribed search term into the subject at the correct position.

      OPTIONAL To be grammatically correct, we should make the word 'tweets' singular if the number of new tweets is 1. If you like, replace the word 'tweets' with this expression: if(equals(length(body('Search_tweets')), 1), 'Tweet', 'Tweets').

    3. In the Body box, enter any value you like. If you don't want to include anything, just enter a space.
      1. If you would like to include the content of the most recent tweet, click within the Body box and enter any explanatory text along with the expression first(body('Search_tweets'))['TweetText'] via the dynamic content dialog.

        If you would like to include other properties of the most recent tweet in the email body, refer to the list of property paths available in the TweetModel. Simply replace TweetText in the expression with one of the other property paths, such as TweetedBy.

  5. Save the Logic App.

Test out the TwitterNotifier Logic App

Congratulations! The Logic App should now be ready for use. Let's test it out!

Logic Twitter Bobby Tarantino

  1. Save any outstanding changes made to the Logic App using the Save button at the top of the Logic Apps Designer.

  2. Close the Logic Apps Designer using the X in the top right corner of the blade.

  3. If you previously disabled the Logic App while creating it, click the Enable button at the top of the Logic App overview blade.

  4. Once the Logic App is enabled, choose Run Trigger > Recurrence at the top of the Logic App overview blade.

    Alternatively, wait for the recurrence trigger to fire as scheduled.

  5. Choose Refresh at the top of the Logic App overview blade.

  6. Under the Run history section of the Logic App overview blade, find the most recent run of the Logic App. Click its row to view a visualization of the executed workflow.