1

我也在WP Answers上提出了这个问题。但由于这也使用了 Salesforce,我不确定我是否会在那里得到回复。

我在我的网站上使用联系表 7,并希望将 Salesforce 潜在客户跟踪与其集成。

按照本网站的建议,我能够使用我的 oid 添加一个隐藏字段

但是,当我在添加此表单后提交联系表单时,它就会卡住并且永远不会真正返回。一旦我删除隐藏字段,它就会开始正常工作。

有没有人能够将潜在客户跟踪系统与 Wordpress 联系表单插件集成?

我还尝试按照此处提供的说明使用 cform 。但这给出了 fopen 失败的警告。我认为那是因为 fopen 不允许使用 HTTP 包装器进行写操作。不知道作者是如何让它工作的!

将不胜感激任何帮助!我不想使用 salesforce Web-to-lead 表单。谢谢。

4

4 回答 4

1

根据我对将 salesforce 与 cforms 集成的研究,基本原则是您需要 POST 信息需要与 cform POST 信息完全对应。

在写你喜欢的帖子时,我使用他们的示例表单来研究这个过程 - 提供了嵌入式代码 - 然后找到了一种让 cforms 提交数据的方法,按照他们指定的方式格式化为https://www.salesforce.com/ servlet/servlet.WebToLead?encoding=UTF-8他们在表单中的 url。

如果您遇到困难,请随时使用我...

于 2011-08-18T14:44:47.027 回答
0

我花了几个小时寻找解决方案,但没有任何效果,我尝试了所有推荐的解决方案,例如http://daddyanalytics.com/integrating-contact-form-7-and-salesforce/http://www.alexhager.at/how- to-integrate-salesforce-in-contact-form-7/ 我解决了这个问题:)

我也试过插件https://wordpress.org/plugins/forms-3rdparty-integration/

但是没有任何效果,然后在搜索过程中有人发布了带有钩子 wpcf7_mail_components 的解决方案。当我使用代码时,代码真的很有效,这要感谢那个人。我现在不记得链接了。但是,我的目标是让 wpcf7_before_send_mail 可调用和可访问。因为上述建议从未调用过它。

然后我介绍了最后两个参数,即

add_action('wpcf7_before_send_mail', 'my_conversion', 10, 1); //this will call the hook

add_action('wpcf7_before_send_mail', 'my_conversion'); //not calling the hook for me

add_action('wpcf7_before_send_mail', 'my_conversion', 10); //also not calling the hook for me

如果能解决您的问题,请点赞。

所以这里是完整的解决方案:

add_action('wpcf7_before_send_mail', 'my_conversion', 10, 1);

function my_conversion($cf7) {
    $email = $cf7->posted_data["email"];
    $name = $cf7->posted_data["name"];
    $phone = $cf7->posted_data["phone"];
    $business_type = $cf7->posted_data["business-type"];
    $no_stations = $cf7->posted_data["number-of-stations"];
    $lead_source = $cf7->title;

    $post_items[] = 'oid=<YOUR-SALES-FORCE-ID>';
    $post_items[] = 'name=' . $name;
    $post_items[] = 'email=' . $email;
    $post_items[] = 'phone=' . $phone;
    $post_items[] = 'business_type=' . $business_type;
    $post_items[] = 'no_of_stations=' . $no_stations;
    $post_items[] = 'lead_source=' . $lead_source;
    if (!empty($name) && !empty($phone) && !empty($email)) {
        $post_string = implode('&', $post_items);
// Create a new cURL resource
        $ch = curl_init();

        if (curl_error($ch) != "") {
// error handling
        }

        $con_url = 'https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8';
        curl_setopt($ch, CURLOPT_URL, $con_url);
// Set the method to POST
        curl_setopt($ch, CURLOPT_POST, 1);
// Pass POST data
        curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string);
        curl_exec($ch); // Post to Salesforce
        curl_close($ch); // close cURL resource
    }
}
于 2014-09-20T07:42:32.073 回答
0

您是否尝试过按照这篇文章中的说明进行操作?它在您的 functions.php 中提供了您需要的 php 代码,以将 Contact Form 7 与 Salesforce 集成:

http://daddyanalytics.com/integrating-contact-form-7-and-salesforce/

于 2013-08-28T03:36:41.893 回答
0

这对我有用,只需记住将“联系表单 1”更改为您要执行操作的表单的名称,并输入您的 salesforce 业务 ID 而不是示例一。

add_action( 'wpcf7_before_send_mail', 'my_conversion' );
function my_conversion( $contact_form ) {
$title      = $contact_form->title;
$submission = WPCF7_Submission::get_instance();

if ( $submission ) {
    $posted_data = $submission->get_posted_data();
}

if ( 'Contact form 1' == $title ) {

    $email = $posted_data["your-email"];
    $name  = $posted_data["first-name"];
    $last  = $posted_data["last-name"];
    $phone  = $posted_data["tel"];
    $company  = $posted_data["company-name"];
    $company_size = $posted_data["menu-870"];


    $post_items[] = 'oid=00vF80000003zx6';
    $post_items[] = 'first_name=' . $name;
    $post_items[] = 'last_name=' . $last;
    $post_items[] = 'email=' . $email;
    $post_items[] = 'phone=' . $phone;
    $post_items[] = 'company=' . $company;
    $post_items[] = '00df800000BypGb=' . $company_size;

    $post_string = implode( '&', $post_items );

    $ch = curl_init( 'https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8' );
    curl_setopt( $ch, CURLOPT_POSTFIELDS, $post_string );
    curl_setopt( $ch, CURLOPT_POST, 1 );
    curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 );
    curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
    curl_exec( $ch ); // Post to Salesforce
    curl_close( $ch ); // close cURL resource
}
}
于 2016-10-20T11:47:36.830 回答