Skip to content
Snippets Groups Projects
Commit 35949563 authored by jitendra's avatar jitendra
Browse files

Contact zap changes and add documentation

parent b08f3fae
Branches
Tags
No related merge requests found
......@@ -3,19 +3,12 @@
class CRM_Zapier_Triggers_CreateContact {
public function sendData($contactID, $params = []) {
$email = civicrm_api3('Email', 'get', [
$contact = civicrm_api3('Contact', 'getsingle', [
'sequential' => 1,
'contact_id' => $contactID,
'is_primary' => 1,
])['values'][0]['email'] ?? '';
$data = [
'id' => $contactID,
'first_name' => $objectRef->first_name,
'last_name' => $objectRef->last_name,
'email' => $email,
];
]);
$hookURL = CRM_Zapier_Utils::getZapHook('create_contact');
CRM_Zapier_Utils::triggerZap('POST', $hookURL, $data);
CRM_Zapier_Utils::triggerZap('POST', $hookURL, $contact);
}
}
\ No newline at end of file
# nz.co.fuzion.zapier
# CiviCRM Zapier Integration (nz.co.fuzion.zapier)
![Screenshot](/images/screenshot.png)
(*FIXME: In one or two paragraphs, describe what the extension does and why one would download it. *)
Triggers a zap configured on zapier.com from civicrm
The extension is licensed under [AGPL-3.0](LICENSE.txt).
......@@ -37,8 +35,28 @@ cv en zapier
## Usage
(* FIXME: Where would a new user navigate to get started? What changes would they see? *)
### Connect your site account on Zapier.
- Website Base URL = your site base url Eg http:://www.example.com
- Api Key = api key of the permissioned contact.
- Key = CiviCRM site key found in civicrm.settings.php.
### Create a new CiviCRM Zap on Zapier.com
- On zapier.com account and create a zap with App Event = CiviCRM.
- Choose Event = New Contact
- In the CiviCRM account field, setup a new account for your site as mentioned above.
- When you view the zap - a hook URL is displayed. This is added to your civicrm extension settings. This hook can be viewed at `Administer => Zapier Hooks` menu page on your civicrm site.
![Screenshot](/images/connect_civicrm_on_zapier.png)
- Setup an action for a third party app, Eg insert a row in the Google sheet. A fully configured zap should be displayed like -
![Screenshot](/images/zap.png)
### On your civicrm site
- Create a civirule that triggers on “Individual is added”.
- In the Linked Action(s) section, Add an action with value = `Trigger Zap` and click save.
- On the next page, set “Select triggering Zap” = “Create Contact” => Save.
## Known Issues
Now, when a contact is created in civicrm, the civirule is triggered which further triggers the zap on zapier.com to process the third-party app action.
(* FIXME *)
Test by creating an individual contact on your site.
images/connect_civicrm_on_zapier.jpg

105 KiB

images/screenshot.png

11.5 KiB

images/zap.jpg

55 KiB

<?xml version="1.0"?>
<extension key="nz.co.fuzion.zapier" type="module">
<file>zapier</file>
<name>CiviZap</name>
<description>Triggers zap for civicrm events</description>
<name>CiviCRM Zapier Integration</name>
<description>Triggers zap for civicrm events (supports only 2 zap actions for now)</description>
<license>AGPL-3.0</license>
<maintainer>
<author>jitendrapurohit</author>
<email>jitendra@fuzion.co.nz</email>
</maintainer>
<urls>
<url desc="Main Extension Page">http://FIXME</url>
<url desc="Documentation">http://FIXME</url>
<url desc="Support">http://FIXME</url>
<url desc="Main Extension Page">https://github.com/fuzionnz/nz.co.fuzion.zapier</url>
<url desc="Documentation">https://github.com/fuzionnz/nz.co.fuzion.zapier/blob/master/README.md</url>
<url desc="Support">https://github.com/fuzionnz/nz.co.fuzion.zapier</url>
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2021-06-15</releaseDate>
......@@ -24,6 +24,9 @@
<classloader>
<psr4 prefix="Civi\" path="Civi"/>
</classloader>
<requires>
<ext>mjwshared</ext>
</requires>
<civix>
<namespace>CRM/Zapier</namespace>
</civix>
......
......@@ -27,6 +27,8 @@ function zapier_civicrm_xmlMenu(&$files) {
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_install
*/
function zapier_civicrm_install() {
CRM_Core_DAO::executeQuery("INSERT INTO civirule_action (name, label, class_name, is_active)
VALUES('trigger_zap', 'Trigger Zap', 'CRM_CivirulesActions_Zapier_Trigger', 1)");
_zapier_civix_civicrm_install();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment