 | Purpose of this Wiki Page
This page provides Demonstrates another proof by example of how CiviCRM can be integrated with Zapier, By searching for a survey and providing to a survey to a contributor through email when a new contributor is entered in a CiviCRM instance
To be able to carryout the steps on content of this page Practically, the following is required |
The content of this page are based on specific user stories which were listed out to be able to make the idea have a target these are
 | User Story 1
As a fund-raiser I want to automatically send a survey to every donor that donates 50 USD or more so that I am sure that every donor gets a survey and I can judge further steps by the results
|
An outline of the User stories was brought forth by the mentors Erik Hommel and llja De Costa to be able to make the ideas on the user stories very fine these outlines are shown below
Rough Outline of User Story 1
The Outline here describes some of the things we set out to meet the requirement specified by the user stories starting with the first
a CiviCRM install is required
CiviCRM needs to be set up so that a contact can add a donor and receive contributions.
A Zapier account is required, as well as a SurveyMonkey account (at least I assume)
A survey needs to be set up at SurveyMonkey
A CiviCRM API needs to be available that can send data and requests to Zapier (Entity Zapier Action Create
The extension CiviRules (https://civicrm.org/extensions/civirules) needs to be installed and configured so it calls the Zapier Create API whenever a contribution (financial type Donation Status Completed) is greater than 50. The request should be passed to Surveypal on Zapier so a Survey will be sent.
Develop an extension to add a Zapier submit action to CiviRules and a base generic Zapier class to send the data to Zapier through the webhook.
The extension developed to address the requirements of the project can be found Here
 | Just Yet what do you need?
To accomplish this full Idea, the outline had to be shaped as per most of the findings FINDINGS Forum Posts |
Below are the Series of tasks which we had to follow to accomplish the rough outline which has been describe above
Tasks To Accomplish User Story 1
The tasks were as follow: Not actually in preference order
Create a new Trigger for a new contribution
Create a new webhook as the data source
Get a unique URL which will be used to send that data in the webhook
Configure ‘Poster’ to send a POST request with some sample data ( Json obtained from a sample API query on Contributions)
Configure the webhook on zapier
- search for the survey to be sent on SurveyMonkey
Adding existing CiviCRM account for authentication purposes
Add a Gmail account for an action ( test )
- Setup the action as a new draft for in my Gmail account when the webhook works
1. Create a New Trigger For a Contribution
On you Zapier Page you have to click to "MAKE A ZAP!" button and this will take you to the Dashboard section


- search for the CiviCRM application and select it as shown on the image above to continue
this takes you to the page where you can select a trigger for the CiviCRM application as shown below

- Click on the continue button to add the CiviCRM installation account which is accessible by Zapier ( hosted on a server online)

- Test the account and proceed with continue to the next step to get the webhook URL

 | WebHook URL Take note of the webhook URL ; as this is what Zapier uses to communicate with CiviCRM according to the Trigger setup |
- Click on continue to test for connectivity with your CiviCRM install ( Zapier should return a Green Yes Message on success and Red on Failure )

- Move ahead by clicking the continue button to move to the next section
Setting Up SurveyMonkey For Survey Search
Before we move ahead, we need to remember that out main aim is sending a particular survey to a contributor by mail meaning that our action here is to send a mail but
before sending we need to add a search for the survey which we will intend to send to the contributor. This is describe in the next image below
- To setup the search we select surveymonkey on the list of search apps and click on it to configure how the search will be done.

This leads us to the following page where we select the search trigger ( that is what SurveyMonkey will do )

- select "Find Survey" since it is what we intend to use, and this is what will lead us to have the survey
- Next click on the continue button to authenticate with the surveyMonkey credentials to point SurveyMonkey into your account

- Make sure you test the account to see the success message as indicated on the image above
- Click on the continue button to configure what the survey will be looking for based on the CiviCRM New Contribution Trigger
 | what does SurveyMonkey search for?
Survey Monkey searches for the the specified field based on the data that it could obtain from the CiviCRM New Contribution Trigger; For example the fields on CiviCRM are Display Name , email , Totoal Amount , Financial Type etc. So the field it searches should correspond ("in label") with the name of the survey to be searched for. Note: Here we just used "Display Name" as our field. |

Note: In order to choose a different field, click on the little plus on to the right of the field and you will see all the fields to choose amongst
- click on continue after choosing the field to test the survey search

- Next we need to setup the action which is what will happen when we have searched for the survey and successfully found it
Setting Up The Action Application ( Gmail )
- Click on the continue button to go to the page of the action configuration

- Select the action application which is Gmail in our case and click on it to configure the action on Gmail

- Select The action that will be performed "send Email" in our case
- click continue to move to the next step to setup the email account which will send the Email

Note: Remember to Test the account to get the feed back as indicated on the image above
- Click on the Continue Button to move to the next step which is to setup the Email and can be followed from the following images



Note: Any Field value which contains the CiviCRM logo comes from the CiviCRM Trigger data , and all the fields with the surveyMonkey logo come from the SurveyMokey Fields
- The next Step Involves testing the Email if everything works fine with the setup

- Click on the Finish Step to Complete the Zap Setup( Zapier Automatically Turns it on For You )
- If not Name the Zap at the Top-left Corner of the page by clicking on the text area which says 'name this Zap' then save the zap
Testing The Zap
In the Next Steps we will be testing the Zap with The FIrefox poster plug-in and display the results which we have
- First we start the poster plugin which we are going to use to send requests ( CTRL + ALT + P)
Note: check the other example to see how poster is installed in firefox if it is not installed - A new window should open with firefox chrome poster
- Fill In the webhook for this zap
- Fill the API key of the current user of the CiviCRM install

- In the content option, We queried the API Explorer for user story 1 ( all contributions with financial type contribution and total amount >= 50$)
- We took Just one of the records of all the JSON object and placed in the content section
- After everything has been filled, You can click on POST to send a POST request to Zapier
After a few seconds, Poster returns the feedback with the status of the request as shown below

This Response is of type 200 which is a success, Meaning that the data has been sent through the webhook to our Zap on Zapier
Immediately an email is receivedin the inbox of the specified mails during setup of the zap, an example of such is shown below

Note: we can see that all the fields of the apps we explicitly specified on the zap configuration have been given out clearly in the mail