跳转到主要内容

MO 返回 API 和分类

MO 返回 API

返回处理 API 允许您根据潜在客户的分类编程特定操作。

重要提示

记住启用接收 DLR 和 MO 的回调。更多信息 »

要创建脚本,请转到 SMS Configuration 菜单 > Advanced > MO Script

在"MO Script - Code (C#)"字段中,点击 DEFAULT 按钮加载示例脚本:

Boolean OnExecute(izLeads.Business.CSScriptHelperSMS helper, 
izLeads.Business.Data.Public.Sms_resposta resposta,
izLeads.Business.Data.Public.Sms_resposta_tratamento tratamento)
{
Boolean retorno = false;

try
{
helper.Debug("Response Received");
helper.Debug(String.Format("id={0}, From={1}, To={2}, RemoteId={3}, " +
"receivedDate={4:dd/MM/yyyy hh:mm:ss}, companyId={5}, classification={6} -> {7}",
resposta.idResposta,
resposta.From,
resposta.To,
resposta.RemoteID,
resposta.DataRecepcao,
resposta.IdEmpresa,
resposta.Classificacao,
resposta.Mensagem
));

// your code
String ApiKey = "<<insert your api key>>";
helper.SMSService_APIURL = "https://apidb.witi.me/sms/send.aspx?chave=" + ApiKey;

helper.Debug(String.Format("Action: {0}", tratamento.Acao));

// Example of generic SMS sending
if(tratamento.Acao == "LEAD")
{
int routeId = 456;

string body = String.Format("from={0},to={1},classification={2},message={3}",
resposta.From, resposta.To, resposta.Classificacao, resposta.Mensagem);

// Uncomment to send a reply
helper.EnviaSMS("Good evening", resposta.From, routeId, null);
}

tratamento.Tratado = true;

// to reply to SMS test, via the same route,
// fill this variable
// tratamento.ResponderTexto = "Reply 123";
retorno = true;
}
catch(Exception ex)
{
helper.Debug(ex);
}
finally
{
helper.Debug("End OnEvaluate");
}

return retorno;
}
Helper

上面的代码包含解释和一些示例,但您也可以使用标准的 C# 函数以及特殊的 helper 函数(请参阅服务机器人的'helper'部分 点击这里)。

分类

根据收到的响应(MO)配置潜在客户的分类。您可以通过精确单词或正则表达式进行比较。

要开始配置,请转到 SMS Configuration 菜单 > Advanced > Classification 并点击 DEFAULT 按钮。配置通过 JSON 文件完成:

[
{
"TextoPesquisa": "NO",
"TipoCorrespondencia": 0, // 0 = exact, 1 = regular expression
"prioridade": 0,
"Enabled": true,
"Nome": "exact_1",
"Acao": "ignore",
"Tag": "ignore"
},
{
"TextoPesquisa": "YES",
"TipoCorrespondencia": 0,
"prioridade": 0,
"Enabled": true,
"Nome": "exact_2",
"Acao": "LEAD",
"Tag": "LEAD"
},
{
"TextoPesquisa": "(EXIT|CANCEL|STOP|REMOVE|EXCLUDE|EXCLUSION|REMOVE ME|TAKE OUT|UNSUBSCRIBE|SCAM|DON'T WANT ANYMORE|CAN'T TAKE IT|WITHDRAW|EXIT)",
"TipoCorrespondencia": 1,
"prioridade": 100,
"Enabled": true,
"Nome": "regularExpression_1",
"Acao": "blackList",
"Tag": "blackList"
},
...
]