Skip to content

Instantly share code, notes, and snippets.

View karn09's full-sized avatar

John Nieves karn09

View GitHub Profile
@karn09
karn09 / postmark_email_send.json
Created March 17, 2017 19:43
draft email send
{
"name": "kustomer.conversation.email",
"app": "kustomer",
"type": "internal_api",
"inputTemplate": {
"orgId": "/#_env.orgId",
"userId": "/#userId",
"uri": "http://drafts:8000/v1/customers/{{customer}}/drafts",
"method": "POST",
"data": {
@karn09
karn09 / trigger_conversation_create.json
Created March 17, 2017 19:42
new conversation create trigger with additional params
{
"eventName": "kustomer.conversation.create",
"app": "kustomer",
"outputTemplate": {
"sentiment": "/#data.attributes.sentiment",
"suggestedTags": "/#data.attributes.suggestedTags",
"tags": "/#data.attributes.tags",
"satisfaction": "/#data.attributes.satisfaction",
"messageCount": "/#data.attributes.messageCount",
"done": "/#data.attributes.done",
const Promise = require('bluebird')
const request = require('request-promise');
const cheerio = require('cheerio')
const fs = require('fs');
const fsWriteFile = Promise.promisify(fs.writeFile);
const fsMkdir = Promise.promisify(fs.mkdir);
const simpleParser = require('mailparser').simpleParser;
const messagesArr = require('./messages.json');
const _ = require('lodash')
@karn09
karn09 / kobject.create-with-customer.json
Created February 6, 2017 22:20
kobject create with customer and custom attribute
{
"name": "kustomer.kobject.create-with-customer",
"app": "kustomer",
"type": "internal_api",
"inputTemplate": {
"orgId": "/#_env.orgId",
"uri": "http://sobjects:8000/v1/customers/{{{customer}}}/klasses/{{{klassName}}}",
"method": "POST",
"data": {
"externalId": "/#externalId",
@karn09
karn09 / kobject.create-with-customer.json
Created February 6, 2017 22:20
kobject create with customer and custom attribute
{
"name": "kustomer.kobject.create-with-customer",
"app": "kustomer",
"type": "internal_api",
"inputTemplate": {
"orgId": "/#_env.orgId",
"uri": "http://sobjects:8000/v1/customers/{{{customer}}}/klasses/{{{klassName}}}",
"method": "POST",
"data": {
"externalId": "/#externalId",
@karn09
karn09 / kobject.update.json
Created February 6, 2017 22:19
kobject.update with custom
{
"name": "kustomer.kobject.update",
"app": "kustomer",
"type": "internal_api",
"inputTemplate": {
"data": {
"custom": "/#custom",
"tags": "/#tags",
"data": "/#data",
"icon": "/#icon",
@karn09
karn09 / deleteTags.js
Created February 6, 2017 18:12
delete all tags
var kapi = require('../index')({
type: 'prod',
token: ''
});
var Promise = require('bluebird');
function fetchIterator(next) {
var next;
return fetchAll(next)
@karn09
karn09 / find-kobject-last.json
Created February 3, 2017 16:24
find last kobject
{
"name": "kustomer.kobject.find-last",
"type": "internal_api",
"inputTemplate": {
"method": "GET",
"uri": "http://sobjects:8000/v1/customers/{{{customer}}}/klasses/{{klass}}?sort=desc&pageSize=1",
"orgId": "/#_env.orgId"
},
"outputTemplate": {
"data": "/#body.data.0"
{
"description": "",
"name": "update-by-last-kobject",
"steps": [
{
"action": "kustomer.message.find-last",
"id": "2",
"params": {
"klass": "order",
"customer": "/#steps.1.id",
var kapi = require('../index')({
type: 'prod',
token: ''
})
function clearAll(notifs) {
return kapi.notifications.clear(notifs);
}
function fetchNotifs(next) {