我在vtiger crm中添加了联系人,还需要向联系人发送短信 我在vtiger crm中使用了smsnotifier,但是当点击动作中的联系人时,短信不会进行。 如何纠正
答案 0 :(得分:1)
您可以向您的潜在客户,联系人和组织发送短信。要将短信发送到列表视图中的记录,
您的邮件已成功发送给多个收件人。此外,您还可以从该记录的详细信息视图中将SMS发送到个人记录
如果您想使用自定义短信服务提供商,以下是使用spring edge sms网关的示例:
<?php
class SMSNotifier_SpringEdge_Provider implements SMSNotifier_ISMSProvider_Model {
private $username;
private $password;
private $parameters = array();
const SERVICE_URI = 'https://trans.springedge.com/api/';
private static $REQUIRED_PARAMETERS = array(
array('name' => 'apikey', 'label' => 'API Key', 'type' => 'text'),
array('name' => 'sender', 'label' => 'Sender ID', 'type' => 'text'),
array('name' => 'unicode', 'label' => 'Character Set', 'type' => 'picklist', 'picklistvalues' => array('1' => 'Unicode', '0' => 'GSM', 'auto' => 'Auto Detect'))
);
public function getName() {
return 'SpringEdge';
}
public function setAuthParameters($username, $password) {
$this->username = $username;
$this->password = $password;
}
public function setParameter($key, $value) {
$this->parameters[$key] = $value;
}
public function getParameter($key, $defaultvalue = false) {
if (isset($this->parameters[$key])) {
return $this->parameters[$key];
}
return $defaultvalue;
}
public function getRequiredParams() {
return self::$REQUIRED_PARAMETERS;
}
public function getServiceURL($type = false) {
if ($type) {
switch (strtoupper($type)) {
case self::SERVICE_SEND : return self::SERVICE_URI . '/web/send/';
case self::SERVICE_QUERY : return self::SERVICE_URI . '/status/message/';
}
}
return false;
}
protected function prepareParameters() {
foreach (self::$REQUIRED_PARAMETERS as $requiredParam) {
$paramName = $requiredParam['name'];
$params[$paramName] = $this->getParameter($paramName);
}
$params['format'] = 'json';
return $params;
}
public function send($message, $tonumbers) {
if (!is_array($tonumbers)) {
$tonumbers = array($tonumbers);
}
foreach ($tonumbers as $i => $tonumber) {
$tonumbers[$i] = str_replace(array('(', ')', ' ', '-'), '', $tonumber);
}
$params = $this->prepareParameters();
$params['message'] = $message;
$params['to'] = implode(',', $tonumbers);
$serviceURL = $this->getServiceURL(self::SERVICE_SEND);
$httpClient = new Vtiger_Net_Client($serviceURL);
$response = $httpClient->doGet($params);
$rows = json_decode($response, true);
$numbers = explode(',', $params['to']);
$results = array();
$i = 0;
if ($rows['status'] != 'OK') {
foreach ($numbers as $number) {
$result = array();
$result['to'] = $number;
$result['error'] = true;
$result['statusmessage'] = $rows['message'];
$result['id'] = $rows['data'][$i++]['id'];
$result['status'] = self::MSG_STATUS_ERROR;
$results[] = $result;
}
}else{
foreach ($rows['data'] as $value) {
if (is_array($value)) {
$result = array();
$result['error'] = false;
$result['to'] = $value['mobile'];
$result['id'] = $value['id'];
$result['statusmessage'] = $rows['message'];
$result['status'] = $this->checkstatus($value['status']);
$results[] = $result;
}
}
}
return $results;
}
public function checkstatus($status) {
if ($status == 'AWAITED-DLR') {
$result = self::MSG_STATUS_PROCESSING;
} elseif ($status == 'DELIVRD') {
$result = self::MSG_STATUS_DELIVERED;
} else {
$result = self::MSG_STATUS_FAILED;
}
return $result;
}
public function query($messageid) {
$params = $this->prepareParameters();
$params['messageid'] = $messageid;
$serviceURL = $this->getServiceURL(self::SERVICE_QUERY);
$httpClient = new Vtiger_Net_Client($serviceURL);
$response = $httpClient->doGet($params);
$rows = json_decode($response, true);
$result = array();
if ($rows['status'] != 'OK') {
$result['error'] = true;
$result['status'] = self::MSG_STATUS_ERROR;
$result['needlookup'] = 1;
$result['statusmessage'] = $rows['message'];
} else {
$result['error'] = false;
$result['status'] = $this->checkstatus($rows['data']['0']['status']);
$result['needlookup'] = 0;
$result['statusmessage'] = $rows['message'];
}
return $result;
}
function getProviderEditFieldTemplateName() {
return 'BaseProviderEditFields.tpl';
}
}
将以上代码保存为/ modules / SMSNotifier / providers中的springedge.php以供使用。
答案 1 :(得分:0)
vTiger中的Smsnotifier基本上是基于事件的程序,在触发注册事件后发送短信,在您的情况下添加新联系人。你需要检查sms提供程序lpgs和配置,以弄清楚什么是真的出错了。老实说,我认为smsnotifier没有任何问题。以下是您真正需要检查的问题 您使用的是哪个第三方短信服务提供商? 你有足够的资金发送短信吗? 您是否拥有短信提供商注册并批准的短信模板? 您是否按照短信提供商的要求正确附加国家/地区代码?