Movatterモバイル変換


[0]ホーム

URL:


Automate repetitive tasks using Postman Flows

You can use Postman Flows to complete repetitive tasks. Businesses often need to delete emails from multiple systems. Logging in, searching, and deleting emails from multiple locations can be time consuming. This tutorial shows you how to create a flow that deletes an email from three locations each time you run the flow.

For this tutorial, the locations areStripe.com,Brevo.com, and a Postman mock server that acts as a hypothetical internal system.

You can find thecomplete flow in theDevOps Flows workspace.

Prerequisites

  • A Stripe account with a customer with thetest@email.com email address.
  • A Brevo account with a contact with thetest@email.com email address.
  • A Stripe secret key.
  • A Brevo API key.

Fork the collections and environment

Fork these collections from theDevOps Flows workspace into your workspace:

Fork this environment into your workspace:

In thegdpr-delete-email environment, replace<your-brevo-api-key> with your Brevo API key. Replace<your-stripe-secret-key> with your Stripe secret key.

Add API keys

Create the flow

  1. Part one: Delete the contact from Stripe

    • Create a new flow. Add aString block and entertest@email.com.

    • Connect aCreate Variable block and enterCustomer Email.

      Create a variable
    • Connect threeHTTP Request blocks to theStart block, arranged vertically.

      Create three HTTP Request blocks

    • In the topHTTP Request block, selectStripe API > Customers > Search customers.

    • Select thegdpr-delete-email environment.

    • For theemail variable, add aGet Variable block and selectCustomer Email.

      Get the variable
    • Create anIf block next to theHTTP Request block. Add aSelect block to theIf block and changevalue1 tocontacts.

      Add an If block
    • Connect theHTTP Request block’sSuccess output to theIf block’scontacts andData inputs. Next tocontacts, selectbody.data. In the FQL window, enter$count(contacts) > 0.

    • Connect theIf block’sFALSE output to aDisplay block.

    • Rename theDisplay blockContact not found and selectBoolean from the dropdown list.

    • Connect theIf block’sTRUE output to anHTTP Request block. SelectStripe API > Customers > Delete a customer.

    • Also connect theIf block’sTRUE output to theHTTP Request block’scustomer_id input and selectbody.data.0.id.

    • Connect theHTTP Request block’sSuccess output to aDisplay block.

    • Rename theDisplay blockContact deleted and selectBoolean from the dropdown list.

      Stripe contact deleted

  2. Part two: Delete the contact from Brevo

    • In the middleHTTP Request block, selectBrevo > Contact management > Contacts > Get a contact’s details.

    • Select thegdpr-delete-email environment

    • For theemail variable, add aGet Variable block and selectCustomer Email.

    • Connect this block’sSuccess output to anotherHTTP Request block and selectBrevo > Contact management > Contacts > Delete a contact. Also connect the middleHTTP Request block’sSuccess output to the newHTTP Request block’scontact_id input and selectbody.id.

      Add Brevo requests

    • Connect theDelete a contact block’sSuccess output to aDisplay block. Rename theDisplay blockContact deleted and selectBoolean from the dropdown list.

    • Connect aDisplay block to theGet a contact’s detailsHTTP Request block’sFailure output. Rename theDisplay blockContact not found and selectBoolean from the dropdown list.

      Brevo contact deleted

  3. Part three: Delete the contact from an internal system

    • In the bottomHTTP Request block, selectcustomer-list > customer/email.

    • For the email variable, add aGet Variable block and selectCustomer Email.

    • Connect theSuccess output to anHTTP Request block and selectcustomer-list > customer/id.

    • Also connect thecustomer/emailHTTP Request block’sSuccess output to theid input and selectbody.id.

    • Connect thecustomer/idHTTP Request block’sSuccess output to aDisplay block. Rename theDisplay blockContact deleted and selectBoolean from the dropdown list.

    • Connect thecustomer/idHTTP Request block’sFailure output to aDisplay block. Rename theDisplay blockContact not found and selectBoolean from the dropdown list.

      Internal contact deleted

Run the flow

SelectRun. The flow finds and deletes the contact with thetest@email.com email address on Brevo, Stripe, and the internal system. When the contact is deleted, theContact deletedDisplay block showsTrue. If there is no contact with that email address, theContact not foundDisplay block showsFalse.

Last modified: 2025/01/17



[8]ページ先頭

©2009-2025 Movatter.jp