Glyue User Docs
  • What is Glyue?
  • Tutorials
    • Start Here
    • Building a Single-Step Integration
      • 1. Creating the Integration
      • 2. Calling the External System
      • 3. Running the Integration
      • 4. Crafting the Output
    • Building a Multi-System Integration
      • 1. Connecting to the Core
      • 2. Field Mapping
      • 3. Running the Integration
    • Building an Event-Driven Integration
      • 1. Setting up the Mock CRM
      • 2. Receiving Inbound Requests
      • 3. Triggering the Integration from the CRM
    • Building an Email Integration
      • 1. Create and Configure the Integration
      • 2. Input Validation
      • 3. Get Story IDs from Hacker News
      • 4. Get Story Content
      • 5. Sending the Email
      • 6. Wrapping Up
      • 7. Extra credit
        • extra_credit.json
    • Building a RESTful CRUD Web Service
      • 1. Integration Setup
      • 2. Vault Setup
      • 3. Create Web Service Endpoints
      • 4. Execute Web Service Endpoints with Vault Methods
      • 5. Vault Code Examples and Explanation
    • Building a Retrieval API against FIS CodeConnect
      • 1. Integration Setup
      • 2. Service Request Setup
      • 3. Field Mapping Setup
      • 4. Integration and Service Request Hook Setup
      • 5. Testing the Integration
      • 6. Common Errors
    • What is Pre-Mapping?
      • Before you start
      • Bookmarks
      • Source and Targets
      • Field Mapping Status
      • Field Mapping Comments
      • Summary
  • How-To Guides
    • How to Run an Integration from Glyue
    • How to Invite New Users
    • How to Create a Value Mapping Set
    • How to Build and Deploy a Custom Frontend
    • How to Migrate an Integration
    • How to Set Up Single Sign On (SSO)
      • Glyue Setup
      • JumpCloud Setup
      • Azure Setup
      • Okta Setup
      • Glyue SAML Config Reference
    • How to Install the Glyue App for Zoom Contact Center
    • How to use the Vault
  • Reference
    • Integration Builder Page
    • Integration Anatomy
    • Integration Components
      • Integration
      • Service Request
      • Field Mapping
      • Value Mapping Set
      • Value Mapping
      • Validation Rule
      • Mask
      • Integration Config
      • Integration Engine Versions
    • Integration Lifecycle
    • Special Functions
      • add_run_label
      • callint
      • debug
      • end
      • get_namespace
      • humanize
      • import_helper
      • keep
      • list_files
      • map_value
      • open_glyuefile
      • open_vault
      • Data Manipulation Utilities
      • calladapter
    • Special Variables
      • __adapter_config__
      • input
      • parentint
      • retvalue
      • run_history_id
      • Iterables
        • fitem/fidx
        • sritem/sridx
        • vritem/vridx/vrmsg
    • Adapters
      • Generic HTTP Adapter
      • Email SMTP Adapter
    • Web Service Endpoints
    • Vault Reference
  • Glyue Platform Reference
    • Banking Core Connectivity Guide
    • Authentication
    • Permissions
      • Service Accounts
      • Organizations
    • Frontends
    • Idempotency Layer
    • Integration Scheduler
    • Governance Reports
    • Arbitrary Integration Request Content Support
    • Admin Components
    • Logging
  • ETL
    • Glyue ETL Overview
    • Data Connectors
    • Workflows
    • Run History
    • Scheduler
Powered by GitBook
On this page

Was this helpful?

  1. Tutorials
  2. Building an Email Integration

4. Get Story Content

We have communicated with the Hacker News API, but its response contains a list of story ids while we need the URLs for our email digest. Let’s make another request (or rather, a set of requests) to retrieve each story by its id so we can later collate their URLs into a single message.

Service Request: get_story_by_id

  1. From the Build page, with Integration selected under Component, right-click our integration and click Go To > Service Request.

  2. Add a new row, enter the following, and save:

    • Sequence: 100

    • System: HTTP

    • Service Name: n/a

    • Formula Variable: get_story_by_id

    • Call For Each: copy and paste the Python code below. This expression evaluates to the list of ids we got from get_story_ids, then cut off at the limitQuery value (if provided). It’s ok if this code doesn’t make sense yet, so don’t worry!

      get_story_ids.response.payload.unwrap()[:input.payload.limitQuery or None]

Glyue will execute a SR once for every item in its Call For Each. Using python lists is the most common.

Field Mappings for get_story_by_id

  1. Right-click the get_story_by_id SR and select Go To > Field Mapping.

  2. Click [➕ADD ROW] 2 times to get 2 blank rows. Enter the following values and then save:

    • First row

      • Field: url_path

      • Value: f"/v0/item/{sritem}.json"

      • Value Type: str

    • Second row

      • Field: method

      • Value: "GET"

      • Value Type: str

sritem is a special variable that represents the current item in the Call For Each of its parent SR. In this case, sritem will be a story id.

Test get_story_by_id

  1. Navigate to the Run History page (or open it in a new tab to keep it handy!) and re-run the integration with this input payload:

    {
      "email": "user@email.net",
      "limitQuery": 10
    }
  2. It should complete successfully. Wait for the most recent run to appear at the top of the RUNS column and click it to see its STEPS in the middle column. We should see several records now- an INPUT, the first REQUEST (get_story_ids), but after that there should be 10 more REQUEST records labelled with get_story_by_id. Click one of them to view its request and response payloads, which should look something like this:

    • REQUEST

      {
          "service_name": "n/a",
          "payload": {
              "url_path": "/v0/item/36712566.json",
              "method": "GET"
          },
          "sub_requests": {}
      }
    • RESPONSE

      {
          "success": true,
          "payload": {
              "by": "JoeMayoBot",
              "descendants": 0,
              "id": 36712566,
              "score": 1,
              "time": 1689268222,
              "title": "Windows 95, 98, and other decrepit versions can grab online updates again",
              "type": "story",
              "url": "https://arstechnica.com/gadgets/2023/07/windows-95-98-and-other-decrepit-versions-can-grab-online-updates-again/"
          },
          "messages": []
      }

Our Glyue integration has now made 11 requests to an external API, with 10 of them being done in a programmatic fashion. Nice Job!

Previous3. Get Story IDs from Hacker NewsNext5. Sending the Email

Last updated 1 year ago

Was this helpful?