Skip to content
This repository was archived by the owner on May 2, 2023. It is now read-only.

Commit 7e088ce

Browse files
yojekalex
andauthored
remove the 'delete brandId' statement (#128)
Co-authored-by: alex <alex@liveperson.com>
1 parent 55c0706 commit 7e088ce

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -999,6 +999,7 @@ Example payload:
999999
"convId": "220d3639-ae23-4c90-83e8-455e3bb2cf13",
10001000
"conversationDetails": {
10011001
"skillId": "-1",
1002+
"brandId": "2344566",
10021003
"participants": [
10031004
{
10041005
"id": "d51ce914-97ad-4544-a686-8335b61dcdf3",

lib/Transformer.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ module.exports = {
8787
let conversationDetails = change.result.conversationDetails;
8888
delete conversationDetails.convId;
8989
delete conversationDetails.note;
90-
delete conversationDetails.brandId;
9190
delete conversationDetails.groupId;
9291
delete conversationDetails.csatRate;
9392

test/agent_sdk_test.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,28 @@ describe('Agent SDK Tests', () => {
768768

769769
});
770770

771+
it('Should include brandId in the message', done => {
772+
requestCSDSStub.yieldsAsync(null, {}, csdsResponse);
773+
externalServices.login.yieldsAsync(null, {bearer: 'im encrypted', config: {userId: 'imauser'}});
774+
externalServices.getAgentId.yieldsAsync(null, {pid: 'someId'});
775+
const change = {'type':'UPSERT','result':{'convId':'38c1ff4b-24e5-2342-8d05-15a62de2daad','effectiveTTR':-1,'conversationDetails':{'convId':'38c1ff4b-24e5-2342-8d05-15a62de2daad','skillId':'1251428632','participants':{'CONSUMER':['102f83624a545696f5dd87ecdd6edf394430f3445666ba68b533c847abb11'],'MANAGER':['2344566.1282051932','2344566.901083232'],'CONTROLLER':['2344566.1257599432'],'READER':[]},'participantsPId':{'CONSUMER':['102f83624a545696f5dd87ecdd6edf394430f3445666ba68b533c847abb11'],'MANAGER':['f675416a-7d5a-5d06-a7bd-bdf5fcc426a1','8ffebb81-0614-568c-a011-3b17eafc5b9d'],'READER':[]},'dialogs':[{'dialogId':'5Yn6I7hpR6C3JWg4YT-Meg','participantsDetails':[{'id':'102f83624a545696f5dd87ecdd6edf394430f3445666ba68b533c847abb11','role':'CONSUMER','state':'ACTIVE'}],'dialogType':'POST_SURVEY','channelType':'MESSAGING','metaData':{'appInstallId':'896ef5ea-b954-42c9-91b7-a9134a47faa7'},'state':'OPEN','creationTs':1564734095888,'metaDataLastUpdateTs':1564734095887},{'dialogId':'38c1ff4b-24e5-2342-8d05-15a62de2daad','participantsDetails':[{'id':'102f83624a545696f5dd87ecdd6edf394430f3445666ba68b533c847abb11','role':'CONSUMER','state':'ACTIVE'},{'id':'2344566.1282051932','role':'MANAGER','state':'ACTIVE'},{'id':'2344566.1257599432','role':'CONTROLLER','state':'ACTIVE'},{'id':'2344566.901083232','role':'MANAGER','state':'ACTIVE'}],'dialogType':'MAIN','channelType':'MESSAGING','state':'CLOSE','creationTs':1564685380489,'endTs':1564734095888,'metaDataLastUpdateTs':1564734095888,'closedBy':'AGENT'}],'brandId':'2344566','state':'CLOSE','stage':'OPEN','closeReason':'AGENT','startTs':1564685380489,'metaDataLastUpdateTs':1564734095888,'firstConversation':false,'csatRate':0,'ttr':{'ttrType':'NORMAL','value':1200},'note':'','context':{'type':'CustomContext','clientProperties':{'type':'.ClientProperties','appId':'whatsapp','ipAddress':'10.42.138.108','features':['PHOTO_SHARING','QUICK_REPLIES','AUTO_MESSAGES','MULTI_DIALOG','FILE_SHARING','RICH_CONTENT']},'name':'WhatsApp Business'},'conversationHandlerDetails':{'accountId':'2344566','skillId':'1251428632'}},'numberOfunreadMessages':{'102f83624a545696f5dd87ecdd6edf394430f3445666ba68b533c847abb11':1,'2344566.901083232':0,'2344566.1282051932':10},'lastUpdateTime':1564734095888}};
776+
const agent = new Agent({
777+
accountId: 'account',
778+
username: 'me',
779+
password: 'password'
780+
});
781+
782+
agent.on('connected', msg => {
783+
agent.transport.emit('message', {kind: 'notification', type: '.ams.aam.ExConversationChangeNotification', body: { changes:[change]}});
784+
});
785+
786+
787+
agent.on('notification', msg => {
788+
expect(msg).to.be.defined;
789+
expect(msg.body.changes[0].result.conversationDetails.brandId).to.equal('2344566');
790+
done();
791+
});
771792

793+
});
772794

773795
});

0 commit comments

Comments
 (0)