【发布时间】:2017-01-24 18:48:50
【问题描述】:
我们正在尝试创建一个工作流程,最终将联系表单中的潜在客户与企业主联系起来。
工作流程如下: 1) Lead 填写联系表格 2) 使用 Stamplay 与 Unbounce 集成,潜在客户会收到一条文本,询问他们是想“现在”还是“以后”联系他们。
让我们先说“现在”
3) Lead 说“现在”,它将访问 webhook URL 以决定下一步做什么。
在这种特殊情况下,说“现在”,将触发 TWIML 箱以拨打企业主。如果企业主没有接听/不忙,那么我们会向潜在客户发送一条文本,要求他们发送带有“姓名”和“日期/时间”的后续文本。
4) 潜在客户回复包含此信息的文本,然后企业主和潜在客户都会收到有关约会的单独通知。
当用户直接拨打 Twilio 号码时,我已经能够成功完成整个工作流程(还没有以编程方式使用关键字,这是我需要帮助的地方)。
来电时 -> TWIML bin
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Pause length="4"/>
<Say>Please hold, while I connect your call.</Say>
<Pause length="4"/>
<Dial timeout="10"> business owner number </Dial>
<Pause length="4"/>
<Sms>I am currently unavailable. If you'd like me to get in touch, pls reply back with your name, and a time that would work best for you. Thanks, Adam</Sms>
</Response>
收到短信时 -> webhook URL
<?php
// Require the bundled autoload file - the path may need to change
// based on where you downloaded and unzipped the SDK
require __DIR__ . '/twilio-php-master/Twilio/autoload.php';
// Use the REST API Client to make requests to the Twilio REST API
use Twilio\Rest\Client;
// Your Account SID and Auth Token from twilio.com/console
$sid = 'xyz';
$token = 'xyz';
$client = new Client($sid, $token);
$number = $_POST['From'];
$body = $_POST['Body'];
//Sends a message to the owner
$sms = $client->account->messages->create(
// Cell of owner
'12345',
array(
// A Twilio phone number you purchased at twilio.com/console
'from' => "78900",
// Lead's reply sent to owner asNotification
'body' => "Hi <name>. You have a new lead. The information for this lead is: $body. You can contact them at $number"
)
);
//Sends a message to the lead
$sms = $client->account->messages->create(
// Cell of Lead
$number,
array(
// A Twilio phone number you purchased at twilio.com/console
'from' => "78900",
// Notification Message sent to Lead
'body' => "This is a confirmation that I have received your information, and will be in contact with you soon. Thanks, <name>."
)
);
我遇到的问题是使用潜在客户文本“现在”来触发企业主和潜在客户之间的电话。
这是我一直在尝试使用的代码,除了我一直收到 11200- HTTP 检索失败 不停。我也尝试过使用 $client->account->calls->create,因为这是我用来成功发送消息的方法。
// Read TwiML at this URL when a call connects (attempt to connect to owner)
$call = $client->calls->create(
'lead-number', // Call this number
'78900', // From a valid Twilio number
array(
'url' => TWIML Bin of Interest
)
);
有人知道我能做什么吗?
【问题讨论】:
标签: twilio twilio-php