2.1.4 • Published 6 years ago

zhike-crm-entrance v2.1.4

Weekly downloads
5
License
ISC
Repository
-
Last release
6 years ago

SmartStudy CRM client information entrance

simple demo

var Entrance = require('./index');
var co = require('co');

var config = {
  mq: {
    aliMns: {
      accountId: '1922933588405985',
      accessKeyId: 'LTAIU8AfwMXFnHPT',
      accessKeySecret: 'xX5bWiZCZ8xlLiGxJFSHU5S5NVO4Uu',
      dataQueue: {
        name: 'test',
        region: 'beijing',
      },
    },
  }
}

/////////////////////////////////////// message producer /////////////////////////////////////
var Entrance = require('./index');
var co = require('co');
var entrance = new Entrance(
  config.mq.aliMns.accountId,
  config.mq.aliMns.accessKeyId,
  config.mq.aliMns.accessKeySecret,
  config.mq.aliMns.dataQueue.name,
  config.mq.aliMns.dataQueue.region, {
  onError: function (err) {
    console.log(err.stack);
  }
});

co(function*() {
  yield entrance.send({aa: 'you'}, {});
}).then(success => {
  console.log('send success')
}, err => console.log(err.stack));

API

  • Constructor

    • accountId required
    • accessKeyId required
    • accessKeySecret required
    • queueName required
    • queueRegion required
    • params.onError
  • send

  • data client infomation required
  • req http request object

data详解*号为新加字段)

key类型说明
marketActivityIdint市场活动id
usernamestring学生姓名(默认:同学)
studyIntentionstring学习意向
referrerstring推荐人
provincestring
citystring城市
importRemarktext导入备注
commenttext备注
phonestring学生手机
userIdint用户在用户系统中的id
siteIdint站点ID,可通过 zhike-crm-entrance 的 npm 包从 cookie 中读出并自动添加上
hmsrIdint渠道ID,可通过 zhike-crm-entrance 的 npm 包从 cookie 中读出并自动添加上
hmplIdint计划ID,可通过 zhike-crm-entrance 的 npm 包从 cookie 中读出并自动添加上
hmmdIdint媒介ID,可通过 zhike-crm-entrance 的 npm 包从 cookie 中读出并自动添加上
hmciIdint创意ID,可通过 zhike-crm-entrance 的 npm 包从 cookie 中读出并自动添加上
hmkwIdint关键词ID,可通过 zhike-crm-entrance 的 npm 包从 cookie 中读出并自动添加上
remarkstring备注(在学生的备注字段追加的数据,而非生成学员的时候的备注信息)
experienceCourseAppointmentAtstring预约体验课时间,为ISO 8601格式的string类型,Date类型JSON.stringify后自动会转换成此格式
experienceCourseTypeint预约体验课类型,1为线上体验课,2为线下体验课
extensionstring附加字段,为JSON格式的字符串

如果存在extension字段,则extension中的数据都会扩展到最外层,形如: var finalData = Object.assign({}, JSON.parse(data.extension), data);

其中,服务前置化的extension中,必须带有预约体验课的时间和预约体验课类型字段(也可以在顶层字段中设置):

key类型说明
experienceCourseAppointmentAtstring预约体验课时间,为ISO 8601格式的string类型,Date类型JSON.stringify后自动会转换成此格式
experienceCourseTypeint预约体验课类型,1为线上体验课,2为线下体验课

示例:

{
  "phone": "18800002222",
  "siteId": 0,
  "hmsrId": 12,
  "hmplId": 156,
  "hmmdId": 0,
  "hmciId": 0,
  "hmkwId": 0,
  "extension":"{\"experienceCourse\":\"2016-12-05T11:47:00.559Z\",\"experienceCourseType\":1}"
}

必填字段: 1. 服务前置化: phone, experienceCourseAppointmentAt, experienceCourseType

  1. 自然流量导入: phone, userId

  2. 在学员的备注中追加信息(移动端的需求) phone, userId, remark

  3. 其他导入数据 phone

Run Tests

npm test
2.1.4

6 years ago

2.1.3

7 years ago

2.1.2

7 years ago

2.1.1

7 years ago

2.1.0

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.0

8 years ago