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 are Stripe.com, Brevo.com, and a Postman mock server that acts as a hypothetical internal system.
You can find the complete flow here.
test@email.com
email address.test@email.com
email address.Fork these collections from the [DevOps flows] workspace into your workspace:
Fork this environment into your workspace:
In the gdpr-delete-email environment, replace <your-brevo-api-key>
with your Brevo API key. Replace <your-stripe-secret-key>
with your Stripe secret key.
Part one: Delete the contact from Stripe
Create a new flow. Add a String block and enter test@email.com
.
Connect a Create Variable block and enter Customer Email
.
Connect three Send Request blocks to the Start block, arranged vertically.
In the top Send Request block, select Stripe API > Customers > Search customers.
Select the gdpr-delete-email environment.
For the email
variable, add a Get Variable block and select Customer Email.
Create an If block next to the Send Request block. Add a Select block to the If block and change value1
to contacts
.
Connect the Send Request block's Success output to the If block's contacts
and Data inputs. Next to contacts
, select body.data
. In the FQL window, enter $count(contacts) > 0
.
Connect the If block's FALSE output to a Display block.
Rename the Display block Contact not found
and select Boolean from the dropdown list.
Connect the If block's TRUE output to a Send Request block. Select Stripe API > Customers > Delete a customer.
Also connect the If block's TRUE output to the Send Request block's customer_id input and select body.data.0.id
.
Connect the Send Request block's Success output to a Display block.
Rename the Display block Contact deleted
and select Boolean from the dropdown list.
Part two: Delete the contact from Brevo
In the middle Send Request block, select Brevo > Contact management > Contacts > Get a contact's details.
Select the gdpr-delete-email environment
For the email
variable, add a Get Variable block and select Customer Email.
Connect this block's Success output to another Send Request block and select Brevo > Contact management > Contacts > Delete a contact. Also connect the middle Send Request block's Success output to the new Send Request block's contact_id input and select body.id
.
Connect the Delete a contact block's Success output to a Display block. Rename the Display block Contact deleted
and select Boolean from the dropdown list.
Connect a Display block to the Get a contact's details Send Request block's Failure output. Rename the Display block Contact not found
and select Boolean from the dropdown list.
Part three: Delete the contact from an internal system
In the bottom Send Request block, select customer-list > customer/email.
For the email variable, add a Get Variable block and select Customer Email.
Connect the Success output to a Send Request block and select customer-list > customer/id.
Also connect the customer/email Send Request block's Success output to the id input and select body.id
.
Connect the customer/id Send Request block's Success output to a Display block. Rename the Display block Contact deleted
and select Boolean from the dropdown list.
Connect the customer/id Send Request block's Failure output to a Display block. Rename the Display block Contact not found
and select Boolean from the dropdown list.
Select Run. The flow finds and deletes the contact with the test@email.com
email address on Brevo, Stripe, and the internal system. When the contact is deleted, the Contact deleted
Display block shows True. If there is no contact with that email address, the Contact not found
Display block shows False.
Last modified: 2023/07/27
Additional resources
Blog posts