-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DEVEXP-321: Add sub methods for messages and events (#35)
- Loading branch information
1 parent
1c465f4
commit c77ac00
Showing
58 changed files
with
2,526 additions
and
490 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
examples/simple-examples/src/conversation/events/sendAgentJoinedEvent.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { ContactId, SendAgentJoinedEventRequestData } from '@sinch/sdk-core'; | ||
import { getAppIdFromConfig, getContactIdFromConfig, initClient, printFullResponse } from '../../config'; | ||
|
||
(async () => { | ||
console.log('********************'); | ||
console.log('* Events_SendEvent *'); | ||
console.log('********************'); | ||
|
||
const appId = getAppIdFromConfig(); | ||
const contactId = getContactIdFromConfig(); | ||
|
||
const requestData: SendAgentJoinedEventRequestData<ContactId> = { | ||
sendEventRequestBody: { | ||
app_id: appId, | ||
recipient: { | ||
contact_id: contactId, | ||
}, | ||
event: { | ||
agent_joined_event: { | ||
agent: { | ||
display_name: 'Agent bot name', | ||
type: 'BOT', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
const sinchClient = initClient(); | ||
const response = await sinchClient.conversation.events.sendAgentJoinedEvent(requestData); | ||
|
||
printFullResponse(response); | ||
|
||
})(); |
34 changes: 34 additions & 0 deletions
34
examples/simple-examples/src/conversation/events/sendAgentLeftEvent.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { ContactId, SendAgentLeftEventRequestData } from '@sinch/sdk-core'; | ||
import { getAppIdFromConfig, getContactIdFromConfig, initClient, printFullResponse } from '../../config'; | ||
|
||
(async () => { | ||
console.log('********************'); | ||
console.log('* Events_SendEvent *'); | ||
console.log('********************'); | ||
|
||
const appId = getAppIdFromConfig(); | ||
const contactId = getContactIdFromConfig(); | ||
|
||
const requestData: SendAgentLeftEventRequestData<ContactId> = { | ||
sendEventRequestBody: { | ||
app_id: appId, | ||
recipient: { | ||
contact_id: contactId, | ||
}, | ||
event: { | ||
agent_left_event: { | ||
agent: { | ||
display_name: 'Agent bot name', | ||
type: 'BOT', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
const sinchClient = initClient(); | ||
const response = await sinchClient.conversation.events.sendAgentLeftEvent(requestData); | ||
|
||
printFullResponse(response); | ||
|
||
})(); |
31 changes: 31 additions & 0 deletions
31
examples/simple-examples/src/conversation/events/sendCommentReplyEvent.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { ContactId, SendCommentReplyEventRequestData } from '@sinch/sdk-core'; | ||
import { getAppIdFromConfig, getContactIdFromConfig, initClient, printFullResponse } from '../../config'; | ||
|
||
(async () => { | ||
console.log('********************'); | ||
console.log('* Events_SendEvent *'); | ||
console.log('********************'); | ||
|
||
const appId = getAppIdFromConfig(); | ||
const contactId = getContactIdFromConfig(); | ||
|
||
const requestData: SendCommentReplyEventRequestData<ContactId> = { | ||
sendEventRequestBody: { | ||
app_id: appId, | ||
recipient: { | ||
contact_id: contactId, | ||
}, | ||
event: { | ||
comment_reply_event: { | ||
text: 'Comment data', | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
const sinchClient = initClient(); | ||
const response = await sinchClient.conversation.events.sendCommentReplyEvent(requestData); | ||
|
||
printFullResponse(response); | ||
|
||
})(); |
29 changes: 29 additions & 0 deletions
29
examples/simple-examples/src/conversation/events/sendComposingEndEvent.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { ContactId, SendComposingEndEventRequestData } from '@sinch/sdk-core'; | ||
import { getAppIdFromConfig, getContactIdFromConfig, initClient, printFullResponse } from '../../config'; | ||
|
||
(async () => { | ||
console.log('********************'); | ||
console.log('* Events_SendEvent *'); | ||
console.log('********************'); | ||
|
||
const appId = getAppIdFromConfig(); | ||
const contactId = getContactIdFromConfig(); | ||
|
||
const requestData: SendComposingEndEventRequestData<ContactId> = { | ||
sendEventRequestBody: { | ||
app_id: appId, | ||
recipient: { | ||
contact_id: contactId, | ||
}, | ||
event: { | ||
composing_end_event: {}, | ||
}, | ||
}, | ||
}; | ||
|
||
const sinchClient = initClient(); | ||
const response = await sinchClient.conversation.events.sendComposingEndEvent(requestData); | ||
|
||
printFullResponse(response); | ||
|
||
})(); |
29 changes: 29 additions & 0 deletions
29
examples/simple-examples/src/conversation/events/sendComposingEvent.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { ContactId, SendComposingEventRequestData } from '@sinch/sdk-core'; | ||
import { getAppIdFromConfig, getContactIdFromConfig, initClient, printFullResponse } from '../../config'; | ||
|
||
(async () => { | ||
console.log('********************'); | ||
console.log('* Events_SendEvent *'); | ||
console.log('********************'); | ||
|
||
const appId = getAppIdFromConfig(); | ||
const contactId = getContactIdFromConfig(); | ||
|
||
const requestData: SendComposingEventRequestData<ContactId> = { | ||
sendEventRequestBody: { | ||
app_id: appId, | ||
recipient: { | ||
contact_id: contactId, | ||
}, | ||
event: { | ||
composing_event: {}, | ||
}, | ||
}, | ||
}; | ||
|
||
const sinchClient = initClient(); | ||
const response = await sinchClient.conversation.events.sendComposingEvent(requestData); | ||
|
||
printFullResponse(response); | ||
|
||
})(); |
33 changes: 33 additions & 0 deletions
33
examples/simple-examples/src/conversation/events/sendGenericEvent.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { ContactId, SendGenericEventRequestData } from '@sinch/sdk-core'; | ||
import { getAppIdFromConfig, getContactIdFromConfig, initClient, printFullResponse } from '../../config'; | ||
|
||
(async () => { | ||
console.log('********************'); | ||
console.log('* Events_SendEvent *'); | ||
console.log('********************'); | ||
|
||
const appId = getAppIdFromConfig(); | ||
const contactId = getContactIdFromConfig(); | ||
|
||
const requestData: SendGenericEventRequestData<ContactId> = { | ||
sendEventRequestBody: { | ||
app_id: appId, | ||
recipient: { | ||
contact_id: contactId, | ||
}, | ||
event: { | ||
generic_event: { | ||
payload: { | ||
key: 'value for the generic event', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
const sinchClient = initClient(); | ||
const response = await sinchClient.conversation.events.sendGenericEvent(requestData); | ||
|
||
printFullResponse(response); | ||
|
||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
examples/simple-examples/src/conversation/messages/sendCardMessage.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { ContactId, SendCardMessageRequestData } from '@sinch/sdk-core'; | ||
import { getAppIdFromConfig, getContactIdFromConfig, initClient, printFullResponse } from '../../config'; | ||
|
||
(async () => { | ||
console.log('****************************'); | ||
console.log('* Messages_SendCardMessage *'); | ||
console.log('****************************'); | ||
|
||
const appId = getAppIdFromConfig(); | ||
const contactId = getContactIdFromConfig(); | ||
|
||
const requestData: SendCardMessageRequestData<ContactId> = { | ||
sendMessageRequestBody: { | ||
app_id: appId, | ||
message: { | ||
card_message: { | ||
title: 'Card message title', | ||
description: 'Card message description', | ||
height: 'MEDIUM', | ||
}, | ||
}, | ||
recipient: { | ||
contact_id: contactId, | ||
}, | ||
correlation_id: 'correlatorId', | ||
queue: 'HIGH_PRIORITY', | ||
processing_strategy: 'DEFAULT', | ||
channel_priority_order: ['MESSENGER'], | ||
}, | ||
}; | ||
|
||
const sinchClient = initClient(); | ||
const response = await sinchClient.conversation.messages.sendCardMessage(requestData); | ||
|
||
printFullResponse(response); | ||
|
||
})(); |
46 changes: 46 additions & 0 deletions
46
examples/simple-examples/src/conversation/messages/sendCarouselMessage.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { ContactId, SendCarouselMessageRequestData } from '@sinch/sdk-core'; | ||
import { getAppIdFromConfig, getContactIdFromConfig, initClient, printFullResponse } from '../../config'; | ||
|
||
(async () => { | ||
console.log('********************************'); | ||
console.log('* Messages_SendCarouselMessage *'); | ||
console.log('********************************'); | ||
|
||
const appId = getAppIdFromConfig(); | ||
const contactId = getContactIdFromConfig(); | ||
|
||
const requestData: SendCarouselMessageRequestData<ContactId> = { | ||
sendMessageRequestBody: { | ||
app_id: appId, | ||
message: { | ||
carousel_message: { | ||
cards: [ | ||
{ | ||
title: 'Card #1 title', | ||
description: 'Card #1 description', | ||
height: 'TALL', | ||
}, | ||
{ | ||
title: 'Card #2 title', | ||
description: 'Card #2 description', | ||
height: 'TALL', | ||
}, | ||
], | ||
}, | ||
}, | ||
recipient: { | ||
contact_id: contactId, | ||
}, | ||
correlation_id: 'correlatorId', | ||
queue: 'HIGH_PRIORITY', | ||
processing_strategy: 'DEFAULT', | ||
channel_priority_order: ['MESSENGER'], | ||
}, | ||
}; | ||
|
||
const sinchClient = initClient(); | ||
const response = await sinchClient.conversation.messages.sendCarouselMessage(requestData); | ||
|
||
printFullResponse(response); | ||
|
||
})(); |
Oops, something went wrong.