doujiao7325 2018-07-19 16:45
浏览 26

Insightly Modx PHP集成,可以很好地创建新的联系人

I'm currently trying to figure out a way to create contacts in insightly using a form on my website. I'm using modx and formIt, the form uses formIt to save all the forms, and modx is letting me use the form inputs in the insightly call. I found this online and based my php call off of it.

My PHP call looks like this:

<?php
$modx->log(xPDO::LOG_LEVEL_ERROR,'Insightly CRM Intgration Hook for Contact Form');

$service_url = 'https://api.insight.ly/v2.3/Contacts';
$ch = curl_init($service_url);
curl_setopt($ch,
CURLOPT_HTTPHEADER,
array('Content-Type:application/json',
'Authorization:Basic' .base64_encode('my_api_key')));

curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$data = json_encode(array(
    'CONTACT_ID'=>100,
    'FIRST_NAME'=>"[[+fname]]", 
    'LAST_NAME'=>"[[+lname]]",
    'EMAIL_ADDRESS'=>"[[+email]]",
    'PHONE_MOBILE'=>"[[+phone]]"
    )
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$return = curl_exec($ch);
$err = curl_errno($ch);
$msg = curl_error($ch);

echo $return;

curl_close($ch);
return true;

I am just doing some testing so I just put in an arbitrary CONTACT_ID, I don't know/couldn't find if that needs to be put in specifically or if insightly takes care of it. Leaving it out did not make it work either.

My main goal is to create a contact in the insightly database using insightly v2.3 using an html form.

  • 写回答

1条回答 默认 最新

  • douda5227 2018-07-19 17:25
    关注

    Well looking at the API reference, they have the contact_id set to 0 - so I would imagine you should try that

    insight.ly API Reference

    评论

报告相同问题?

悬赏问题

  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测