-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Delete Conversation and Formatted Transcript APIs (#47)
* Updated Readme doc Added PUT APIs * Fixed Links issues Fixed Links issues * Put events (#44) * Added Put APIs * Added test cases for Put APIs * Added Delete and Formatted transcript APIs (#46) * Added Delete and Formatted transcript APIs * Updated examples * Added More examples * Handled Exception 404 * Updated examples * Added Test cass * Update readme.md
- Loading branch information
1 parent
bd5e5e5
commit 948fa0d
Showing
18 changed files
with
1,067 additions
and
53 deletions.
There are no files selected for viewing
225 changes: 225 additions & 0 deletions
225
example/Conversation_APIs/Delete_APIs/delete_api_async.py
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,225 @@ | ||
import symbl | ||
|
||
payload2 = { | ||
"name": "TestingTextAPI", | ||
"trackers": [{ | ||
"name": "text_tracker", | ||
"vocabulary": [ | ||
"indians", | ||
"thoughts", | ||
"vaccination" | ||
] | ||
}], | ||
"detectEntities": "true", | ||
"enableAllTrackers": "true", | ||
"messages": [ | ||
{ | ||
"payload": { | ||
"content": "Let us talk about India Australia Testaments start seeing each other in the past as much we thought like it will be one-sided." | ||
}, | ||
"from": { | ||
"userId": "natalia@example.com", | ||
"name": "Natalia" | ||
}, | ||
"duration": { | ||
"startTime": "2020-07-21T16:04:19.01Z", | ||
"endTime": "2020-07-21T16:04:20.99Z" | ||
} | ||
}, | ||
{ | ||
"payload": { | ||
"content": "Only working with is occupied at the moment:blush: , but just generally /there's going to be a lot of (infographic) making done and if you would like to make them yourself I can give you access to then gauge:confetti_ball: . ." | ||
}, | ||
"from": { | ||
"userId": "mike@abccorp.com", | ||
"name": "Mike" | ||
}, | ||
"duration": { | ||
"startTime": "2020-07-21T16:04:19.99Z", | ||
"endTime": "2020-07-21T16:04:20.99Z" | ||
} | ||
}, | ||
{ | ||
"payload": { | ||
"content": "We wouldn't have thought like India can win that test match. tomorrow on 21 june, 2021 is our match i think" | ||
}, | ||
"from": { | ||
"userId": "natalia@example.com", | ||
"name": "Natalia" | ||
}, | ||
"duration": { | ||
"startTime": "2020-07-21T16:04:20.99Z", | ||
"endTime": "2020-07-21T16:04:21.99Z" | ||
} | ||
}, | ||
{ | ||
"payload": { | ||
"content": "Yeah, no one could ever like predict that India would dominate all the other matches against really started harassing Indians alone, including mom." | ||
}, | ||
"from": { | ||
"userId": "steve@abccorp.com", | ||
"name": "Steve" | ||
}, | ||
"duration": { | ||
"startTime": "2020-07-21T16:04:20.99Z", | ||
"endTime": "2020-07-21T16:04:22.99Z" | ||
} | ||
}, | ||
{ | ||
"payload": { | ||
"content": "Other mothers but against give it to fight and Australians also then accepted the defeat gracefully and congratulated the Indian team for their unique victory." | ||
}, | ||
"from": { | ||
"userId": "natalia@example.com", | ||
"name": "Natalia" | ||
}, | ||
"duration": { | ||
"startTime": "2020-07-21T16:04:23.99Z", | ||
"endTime": "2020-07-21T16:04:24.99Z" | ||
} | ||
}, | ||
{ | ||
"payload": { | ||
"content": "And a test on this much." | ||
}, | ||
"from": { | ||
"userId": "mike@abccorp.com", | ||
"name": "Mike" | ||
}, | ||
"duration": { | ||
"startTime": "2020-07-21T16:04:25.99Z", | ||
"endTime": "2020-07-21T16:04:26.99Z" | ||
} | ||
}, | ||
{ | ||
"payload": { | ||
"content": "We will again have to talk based on the topic Rohit water to the topics, and we see the topics that are generated here." | ||
}, | ||
"from": { | ||
"userId": "natalia@example.com", | ||
"name": "Natalia" | ||
}, | ||
"duration": { | ||
"startTime": "2020-07-21T16:04:27.99Z", | ||
"endTime": "2020-07-21T16:04:29.99Z" | ||
} | ||
}, | ||
{ | ||
"payload": { | ||
"content": "I don't know what clean water spaghetti tacos." | ||
}, | ||
"from": { | ||
"userId": "steve@abccorp.com", | ||
"name": "Steve" | ||
}, | ||
"duration": { | ||
"startTime": "2020-07-21T16:04:30.99Z", | ||
"endTime": "2020-07-21T16:04:31.99Z" | ||
} | ||
}, | ||
{ | ||
"payload": { | ||
"content": "Australian distance Indians, so we can talk about Indians." | ||
}, | ||
"from": { | ||
"userId": "steve@abccorp.com", | ||
"name": "Steve" | ||
}, | ||
"duration": { | ||
"startTime": "2020-07-21T16:04:32.99Z", | ||
"endTime": "2020-07-21T16:04:33.99Z" | ||
} | ||
}, | ||
{ | ||
"payload": { | ||
"content": "Yeah, yeah, we can talk about it." | ||
}, | ||
"from": { | ||
"userId": "natalia@example.com", | ||
"name": "Natalia" | ||
}, | ||
"duration": { | ||
"startTime": "2020-07-21T16:04:34.99Z", | ||
"endTime": "2020-07-21T16:04:35.99Z" | ||
} | ||
}, | ||
{ | ||
"payload": { | ||
"content": "Let us talk about the Indian culture." | ||
}, | ||
"from": { | ||
"userId": "mike@abccorp.com", | ||
"name": "Mike" | ||
}, | ||
"duration": { | ||
"startTime": "2020-07-21T16:04:36.99Z", | ||
"endTime": "2020-07-21T16:04:37.99Z" | ||
} | ||
}, | ||
{ | ||
"payload": { | ||
"content": "We will again have to talk based on the topic Rohit water to the topics, and we see the topics that are generated here." | ||
}, | ||
"from": { | ||
"userId": "natalia@example.com", | ||
"name": "Natalia" | ||
}, | ||
"duration": { | ||
"startTime": "2020-07-21T16:04:38.99Z", | ||
"endTime": "2020-07-21T16:04:40.99Z" | ||
} | ||
}, | ||
{ | ||
"payload": { | ||
"content": "Let us go." | ||
}, | ||
"from": { | ||
"userId": "steve@abccorp.com", | ||
"name": "Steve" | ||
}, | ||
"duration": { | ||
"startTime": "2020-07-21T16:04:40.99Z", | ||
"endTime": "2020-07-21T16:04:41.99Z" | ||
} | ||
}, | ||
{ | ||
"payload": { | ||
"content": "Indians are really very current Indians are great people but sometimes pay." | ||
}, | ||
"from": { | ||
"userId": "steve@abccorp.com", | ||
"name": "Steve" | ||
}, | ||
"duration": { | ||
"startTime": "2020-07-21T16:04:42.99Z", | ||
"endTime": "2020-07-21T16:04:43.99Z" | ||
} | ||
}, | ||
{ | ||
"payload": { | ||
"content": "Also, very violent." | ||
}, | ||
"from": { | ||
"userId": "steve@abccorp.com", | ||
"name": "Steve" | ||
}, | ||
"duration": { | ||
"startTime": "2020-07-21T16:08:44.99Z", | ||
"endTime": "2020-07-21T16:08:45.99Z" | ||
} | ||
} | ||
], | ||
"entities": [ | ||
{ | ||
"customType": "identify_org", | ||
"text": "platform" | ||
} | ||
] | ||
|
||
} | ||
|
||
conversation_object = symbl.Text.process(payload=payload2) | ||
print(conversation_object.get_members()) | ||
print(conversation_object.delete_conversation()) | ||
print(conversation_object.get_messages()) | ||
|
4 changes: 4 additions & 0 deletions
4
example/Conversation_APIs/Delete_APIs/delete_api_conversationApi.py
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,4 @@ | ||
import symbl | ||
#to use the delete API using ConversationApi class | ||
conversation_id = "1234567890" | ||
print(symbl.Conversations.delete_conversation(conversation_id)) |
14 changes: 14 additions & 0 deletions
14
example/Conversation_APIs/Delete_APIs/delete_api_streaming.py
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,14 @@ | ||
import symbl | ||
events = { | ||
'message': lambda response: print(response), | ||
'message_response': lambda response: print('Final Messages -> ', [ message['payload']['content'] for message in response['messages']]) | ||
} | ||
connection_object = symbl.Streaming.start_connection(insight_types=['question', 'action_item'],speaker= { | ||
'userId': 'abc@example.com', | ||
'name': 'abc', | ||
}) | ||
connection_object.subscribe(events) | ||
|
||
connection_object.send_audio_from_mic() | ||
|
||
print(connection_object.conversation.delete_conversation()) |
64 changes: 64 additions & 0 deletions
64
example/Conversation_APIs/Delete_APIs/delete_api_telephony_pstn.py
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,64 @@ | ||
|
||
import symbl | ||
|
||
|
||
phoneNumber = "" # Zoom phone number to be called, which is mentioned into the Zoom meeting invitation | ||
meetingId = "" # Your zoom meetingId | ||
password = "" # Your zoom meeting passcode | ||
emailId = "" # Email address on which you would like to receive the detailed summary of the meeting | ||
|
||
|
||
# here are all events supported by Telephony API, you just need to uncomment the event which you would like to use | ||
events = { | ||
'transcript_response': lambda transcript: print('printing the transcript response ', str(transcript)) | ||
,'message_response': lambda message: print('printing the message response ', str(message)) | ||
#,'insight_response': lambda insight: print('printing the insight response ', str(insight)) | ||
#,'topic_response': lambda topic: print('printing the topic response ', str(topic)) | ||
} | ||
|
||
connection_object = symbl.Telephony.start_pstn( | ||
phone_number=phoneNumber, | ||
dtmf = ",,{}#,,{}#".format(meetingId, password), | ||
actions = [ | ||
{ | ||
"invokeOn": "stop", | ||
"name": "sendSummaryEmail", | ||
"parameters": { | ||
"emails": [ | ||
emailId | ||
], | ||
}, | ||
}, | ||
]) | ||
|
||
connection_object.subscribe(events) | ||
|
||
connection_object.conversation.delete_conversation() | ||
|
||
# you can get the response from the conversation object, when you will stop the connection explicitly using keyboard interrupt or by using | ||
# connection_object.stop() # you can also stop the connection after sspecifying some interval of timing | ||
|
||
# To get the message from the meeting | ||
#print(connection_object.conversation.get_messages()) | ||
|
||
#To get the conversation data from the conversation | ||
#print(connection_object.conversation.get_conversation()) | ||
|
||
# To get the action items from the meeting | ||
# print(connection_object.conversation.get_action_items()) | ||
|
||
# To get the follow ups from the meeting | ||
# print(connection_object.conversation.get_follow_ups()) | ||
|
||
# To get the members information from the meeting | ||
# print(connection_object.conversation.get_members()) | ||
|
||
# To get the topics from the meeting | ||
# print(connection_object.conversation.get_topics()) | ||
|
||
# To get the questions from the meeting | ||
# print(connection_object.conversation.get_questions()) | ||
|
||
# To get the analytics from the conversation | ||
#print(connection_object.conversation.get_analytics()) | ||
|
45 changes: 45 additions & 0 deletions
45
example/Conversation_APIs/Delete_APIs/delete_api_telephony_sip.py
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,45 @@ | ||
from symbl.utils.Threads import Thread | ||
import symbl | ||
import time | ||
|
||
# here are all events supported by Telephony API, you just need to uncomment the event which you would like to use | ||
events = { | ||
'transcript_response': lambda transcript: print('printing the transcript response ', str(transcript)) | ||
,'message_response': lambda message: print('printing the message response ', str(message)) | ||
#,'insight_response': lambda insight: print('printing the insight response ', str(insight)) | ||
#,'topic_response': lambda topic: print('printing the topic response ', str(topic)) | ||
} | ||
|
||
sip_uri = "<SIP_URL>" | ||
connection_object = symbl.Telephony.start_sip(uri=sip_uri) | ||
|
||
connection_object.subscribe(events) | ||
|
||
print(connection_object.conversation.delete_conversation()) | ||
|
||
# you can get the response from the conversation object, when you will stop the connection explicitly using keyboard interrupt or by using | ||
# connection_object.stop() | ||
|
||
# To get the message from the conversation | ||
#print(connection_object.conversation.get_messages()) | ||
|
||
#To get the conversation data from the conversation | ||
#print(connection_object.conversation.get_conversation()) | ||
|
||
# To get the action items from the conversation | ||
# print(connection_object.conversation.get_action_items()) | ||
|
||
# To get the follow ups from the conversation | ||
# print(connection_object.conversation.get_follow_ups()) | ||
|
||
# To get the members information from the conversation | ||
# print(connection_object.conversation.get_members()) | ||
|
||
# To get the topics from the conversation | ||
# print(connection_object.conversation.get_topics()) | ||
|
||
# To get the questions from the conversation | ||
# print(connection_object.conversation.get_questions()) | ||
|
||
# To get the analytics from the conversation | ||
#print(connection_object.conversation.get_analytics()) |
15 changes: 15 additions & 0 deletions
15
example/Conversation_APIs/Post_APIs/formatted_transcript_ConversationApi.py
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,15 @@ | ||
import symbl | ||
#to test API using ConversationApi class | ||
|
||
payload = { | ||
'contentType': 'text/markdown', | ||
# 'contentType': 'text/srt', | ||
'createParagraphs': "true", | ||
'phrases': { | ||
'highlightOnlyInsightKeyPhrases': "true", | ||
'highlightAllKeyPhrases': "true" | ||
}, | ||
'showSpeakerSeparation': "true" | ||
} | ||
conversation_id = "1234567890" #update with your conversation id | ||
print(symbl.Conversations.get_formatted_transcript(parameters=payload,conversation_id=conversation_id)) |
Oops, something went wrong.