Webhook Example: Parse Emails From Citizens to Create Requests
You must have administrator rights to access this feature.
This feature may not be available in every package. Not sure if you have this feature or you want to learn more about it? Send us a message at support@cartegraph.com.
In this example, we will show how to parse emails in Zapier and use the information to create requests in Cartegraph.
- Go to https://parser.zapier.com and set up a free account or sign in with an existing Zapier account.
- Click Create Mailbox.
- You are given a pseudo inbox; in this example, it is called yy9yfbrf@robot.zapier.com.
- Send a sample email from your email client to the provided email address. Make the subject of the email be New Request and copy the following body text:
Here is a sample request
Issue: Pothole
Location: 620 Melinda Drive
Notes: It’s a big one
-
Once you send the sample email, in Parser by Zapier, you see this screen:
-
Now you can highlight the important text in the initial template area and give each piece a name. If we highlight the word Pothole, the following dialog box displays:
-
Type Issue into the box provided and click Save.
-
Highlight 620 Melinda Drive and enter Location.
-
Highlight It's a big one and enter Notes. Your screen should look like this:
-
Click Save Address and Template.
You can now use your pseudo inbox to send and forward real emails, and the email will be parsed into the pieces you defined.
Now we will create a Zapier zap that does something with those parsed emails.
-
Go to https://zapier.com/
-
Click Make a Zap
-
In the When this happens dialog box, start to type email parser and select Email Parser by Zapier.
-
In the Choose Trigger Event list, select New Email, and click Continue.
-
Allow Zapier to access your email parser by Zapier account by clicking Sign in to Email Parser by Zapier, then click Authorize, and click Continue.
-
Select the mailbox you created in the previous steps and click Continue.
-
Click Test trigger.
-
Click Continue.
-
In the Do this dialog box, begin to type webhooks and select Webhooks by Zapier.
-
From the Choose Action Event list, select Post and then click Continue.
-
You should see a screen that looks like this:
At this point, before we fill out the details for this step in Zapier, we are going to switch to a different browser tab and start to create an automation in Cartegraph. This new automation will have an incoming webhook as its trigger.
-
In another browser window, click
>Automation Manager.
-
Click Create Automation.
-
Start to type the word incoming and then select the Incoming Webhook trigger.
-
The trigger will start our new automation. Our automation will be invoked when an external application calls the URL shown in the URL property on the right side of the screen. Whenever you create a new incoming webhook automation, a unique URL is automatically generated.
-
Click
to the right of the URL to copy the path to the clipboard.
-
Switch back to the browser tab with Zapier. Paste the URL from your clipboard into the URL text box. Set the Payload Type to Json.
- In the Data area, create four properties. Name them Issue, Location, Notes, and Sender. Click the plus buttons to add more rows. Use
to select the following fields to map:
- Parse Output Issue
- Parse Output Location
- Parse Output Notes
- Email Sender Email
- When you have the detail section set up correctly, it should look like the following:
- Scroll to the bottom of the page and click Continue. You will see the following screen. Do not click either Test buttons yet.
We will need to coordinate sending a test message to Cartegraph. To do this we need to click a button in two different browsers in quick succession. Before continuing, it would be easiest if you can arrange your browsers on your monitor or monitors so that you can see Zapier and the Cartegraph automation at the same time.
-
Click the Capture button on the Cartegraph incoming webhook page.
-
Quickly click the Test & Review button in Zapier.
If the test was successful, the Zapier screen should look like this: -
The Cartegraph screen should look like this:
-
To finish the zap in Zapier, click Done Editing.
-
Name your zap in the top left corner and click Turn Zap On.
-
Click Go To My Zaps. You should see this:
-
Switch back to the Cartegraph tab.
The test message sent from Zapier is visible in the Example Body field. The four fields defined there can be used by other blocks in the rest of the automation. -
Click and drag a Create Record block to the Actions section. Change the Recordset to Request.
-
Using the Add Field control, add the Issue Field. Change the mode on the right to (s) for syntax mode and paste [eventsource|Issue] as the value.
-
Using the Add Field control, add the Description and Location Description fields as well. Set the mode to
and select the corresponding values from the incoming webhook. Your screen should now look like this:
-
In the upper left corner of the screen, rename your automation, turn it on, and click Save.
Your automation and Zap are both complete. Every time you forward an email to your pseudo email box, Zapier will parse the email and send the information to your Cartegraph automation with the incoming webhook trigger, and your automation will create a request.