MESA Docs
MESA Homepage
  • Welcome to MESA
    • Installing MESA
    • Dashboard
    • Core Concepts
    • Getting Help
  • Templates
    • Template Library
    • Installing & Editing
  • Workflow Builder
    • Triggers
    • Actions
    • Fields
      • Variables
      • Formatting Variables
      • Liquid Templating
    • Testing
  • Workflow Activity
    • Tasks
      • Troubleshooting
      • Replay
    • Logs
    • Time Travel
  • Best Practices
    • Set Titles & Descriptions
    • Track Time Saved
    • Enable Failure Notifications
    • Avoid Infinite Loops
  • Going Further
    • Plans & Billing
    • Notifications
    • Credentials
    • Understanding the Queue
    • Export & Import Workflows
    • Platform Thresholds & Limits
  • Built-in Tools
    • Activity Log
    • AI
    • API
    • Approval
    • MCP
    • Custom Code
      • Libraries
        • MESA SDK
        • Filter
        • Loop
        • Transform
        • oAuth
        • Shopify
        • ShopifyGraphql
      • FAQ
    • Data
    • Delay
    • Email
    • Filter
    • Form
      • Configure
      • Going Further
      • Technical Notes
    • FTP
    • Image
    • Loop
    • Package Tracking
    • Paths
    • Schedule
    • Scraper
    • SMS
    • Transform
    • Virtual Output
    • Weather
    • Web Request
    • Webhook
  • Apps
    • Airtable
    • Amazon S3
    • Asana
    • Blog Studio
    • ChannelApe
    • Claude
    • ChatGPT
    • Dall-E 2
    • Delighted
    • Digital Humani
    • Discord
    • DocuSign
    • Dropbox
    • Etsy
    • Facebook
    • Fera.ai
    • Gatsby
    • Gmail
      • Send Email
    • Google Analytics 4
    • Google Analytics UA
    • Google Calendar
    • Google Drive
    • Google Forms
    • Google Sheets
      • Add Row
      • Query Rows
      • Update Row
      • Row Created
      • Row Updated (Advanced)
      • Creating New Spreadsheets
      • Technical Notes
    • Gorgias
    • Govalo
    • Help Scout
    • Hubspot
    • Infinite Options
    • Intercom
    • IPDetective
    • Judge.me
    • Katana
    • Klaviyo
      • API Deprecation
    • Loop Returns
    • Loyalty Lion
    • Mailchimp
    • Mailgun
    • Mandrill
    • Mantle
    • Notion
    • Odoo
    • Omnisend
    • Page Studio
    • Pinterest
    • Printful
    • PrintNode
    • QuickBooks
    • Rebuy
    • Recharge
    • Remove.bg
    • Returnly
    • Rivo
    • Salesforce
    • Segment
    • Sendlane
    • Shippo
    • ShipStation
    • Shopify
      • Technical Notes
        • Configuring Your Payload
        • Modifying and Filtering Get Lists
        • Parameters
        • Error Codes
        • Accuracy of orders_count Variable
        • Accuracy of Count Products Action
        • Using the Gift Cards API
        • How to Find a Specific Record in the Testing Interface
        • Order, Customer, and Product Updated Trigger Frequency
    • Shopify Flow
    • Shopify Plus
    • Shopify Retail POS
    • Skio Subscriptions
    • Slack
    • Smartrr
    • Smile.io
    • Square
      • Updating Inventory
      • Frequently Asked Questions
    • Stamped.io
    • Stripe
    • Thanks.io
    • TikTok
    • Tracktor
    • Twilio
    • Uploadery
    • Wonderment
    • Xero
    • Yotpo
    • Yotpo Loyalty
  • For developers
    • Admin API
    • Command Line Interface
    • Embedding templates
  • Frequently asked questions
    • Why isn't the log search returning logs with the search I entered?
    • Is it possible to handle errors or retry steps?
    • How do I handle a failed task?
    • Does MESA auto-save workflows?
    • Can I Use Apps That Don't Have a MESA Connector?
    • Why is my workflow action adding the same data each time it occurs?
    • How do I cancel automations that are already in progress?
    • How do I cancel my MESA subscription or 7-day trial?
    • Can you import code from npm in custom code?
    • Do you have a Slack Community?
Powered by GitBook
On this page
  • Authentication Methods
  • Configure
  • Advanced Settings (found via More Options)
  • Going Further
  • Examples

Was this helpful?

  1. Built-in Tools

API

PreviousAINextApproval

Last updated 4 months ago

Was this helpful?

The API tool allows you to connect MESA with internal services or any publicly-available API.

If you’re looking to trigger your workflow from an API we recommend using a if your API supports webhooks. Otherwise, you can use a trigger and an API action in later steps.

Authentication Methods

MESA offers that you can utilize to connect to an API.

No Authentication

API Key

One of the most common ways to connect to an API.

Key: The name of your API key. Your service's API documentation will specify this.

Value: The value of your API Key that you get from the service's dashboard.

OAuth 2.0

By default, MESA will refresh tokens by using query parameters. If you mark the checkbox, MESA will use POST content to refresh the content.

Basic Auth

Configure

In the API actions, you will find the following fields:

Request Body: Will contain the information that you want to send to the service - used by POST, PUT, PATCH, and DELETE requests

Querystring parameters: A part of a uniform resource locator (URL) that assigns values to a specified parameter(s). Example: https://example.com/over/there?name=ferret

Specify a custom Request Body: This allows you to specify text or a variable for the request body. For instance, you could specify a variable that refers to data from a previous step. The text specified here will be sent as the Request Body instead of anything specified under the Request Body above.

Going Further

Examples

API: No Authentication

Once a workflow runs and the request has been sent, httpbin will return the data (product title, product handle, and price) that we sent to the endpoint.

This was the Response:

Use data obtained from an API

1. You can start building your own workflows by clicking the New Workflow button on the right-hand side of the My workflows page.

4. For the Querystring parameters, you will need to add the parameters (zip and appid).

  • units: Optional parameter to specify the temperature units.

5. Click on the + symbol below that step and select the Shopify Update Order Notes Action. This action will only add the preferred text and will not override any existing order notes on the order.

7. After a test, you can view the Variables Available to view the response from OpenWeatherMap with the debug logging enabled.

8. By viewing the Variables Available, you can figure out the variable to use for the later steps in the workflow.

9. In the Shopify Update Order Notes Action, fill out the following:

  • Notes: If you want to pass the current temperature data down in your workflow, you can use this variable: {{api.main.temp}}

To create a custom variable, click on the plus sign icon next in Settings for that particular API step. Then, click on the Copy key.

In one of the fields, you can type {{ and then paste the copied value. Next, you can manually type in the data that you'd like to send. End the variable with }}

An example of a custom variable is: {{api.feels_like}}

Here is an example of updating the order notes with the current temperature.

Send nested data to an API

To send nested data to an API, you can use dot notation. Here is an example of a nested data structure, with the data nested under data:

{
  "data": {
    "order_id": "2975040733210",
    "total_price": "403.00"
  }
}

Here is how you would set this up in MESA.

Used for interacting with an API that does not require any authentication and provides public API access. To configure the No Authentication Action, please refer to the

MESA will pass down the newly created credential as a key value pair in the header object. If the service expects the API key to be a query string parameter, use step. Here is an example:

To configure the API Key Action, please refer to the

One of the most common ways to connect to an API but requires a more complex set-up. This requires creating an app in your service and entering the information into MESA to create a . When creating an app in your service, you must use this URL as the callback URL:

If your service requires MESA to make a POST request to refresh a token, you can use the Use POST for token refresh setting in the .

Basic Authentication is a simpler method of authentication that involves a username and password. For example, a Shopify private app. You will need to create a .

Method: GET, POST, DELETE, PUT, PATCH (for a summary, read )

URL: Endpoint of a service, for example, . If you are sending URL parameters, include these here. Important: Make sure to include "https://" in the url.

Advanced Settings (found via )

Content Type: Used to tell the client about the original of the resource

Headers: Lets the client & server pass additional information with an HTTP request or response, for example, authentication tokens or the format to return. More information can be found .

When a product is updated, we will make a POST request to the following endpoint:

After updating a product and viewing the , this was the Request:

In this example, we will interact with and update a Shopify order's Notes with the current temperature of the customer's zip code once an order is created.

To utilize their API and obtain an API Key, you will need an .

2. Select the Shopify Order Created trigger. Next, click on Add Step > Actions, search for "API", select the API tool, and then the action.

3. For the Method and URL, you will need to decide on your preferred endpoint.

zip (Required): You can use to use the Shopify Order's zipcode and country code. For this example, the variable is (comma included): {{shopify_order.shipping_address.zip}}, {{shopify_order.shipping_address.country_code}}

appid (Required): Your unique API key, and you can find it on your account page under the .

6. In order to view the information sent by OpenWeatherMap, you will need to enable the , and test your workflow. To learn how to test your workflow, .

Shopify Order ID: Select the Shopify Order Created ID .

Credential
https://app.getmesa.com/apps/mesa/oauth/redirect-token
More options
Credential
this article
https://httpbin.org/anything
More Options
media type
here
https://httpbin.org/anything
Logs
OpenWeatherMap's API
account
Here is an example.
MESA Variables
API key tab
Logging, debug mode logging
click here
variable
Configuration information below.
API's No Authentication
Configuration information below.
No Authentication
Webhook
Schedule
4 different built-in Actions
No Authentication
API Key
OAuth 2.0
Basic Auth