Skip to content

Instantly share code, notes, and snippets.

View shinsaka's full-sized avatar
✍️
Writing python 🔥

Manabu Shinsaka shinsaka

✍️
Writing python 🔥
View GitHub Profile
@shinsaka
shinsaka / VoiceContactOnConnected.json
Last active August 26, 2022 06:47
CTI Flow Sample Scripts (for Amazon Connect CTI Adapter for Salesforce)
{
"actions": [
{
"id": "uid-000",
"type": "SE_Start",
"meta": {},
"controls": {},
"ports": {
"done": "uid-101"
},
@shinsaka
shinsaka / Voice Contact onConnected.json
Last active August 2, 2022 10:01
Open form a new case with contact ID. (Amazon Connect CTI Adapter for Salesforce -- CTI Flow script)
{
"actions": [
{
"id": "uid-start",
"type": "SE_Start",
"meta": {},
"controls": {},
"ports": {
"done": "uid-001"
},
@shinsaka
shinsaka / Voice Contact onConnecting.json
Last active August 2, 2022 02:52
onConnecting CTI FLOW for CTI Adapter for Salesforce
{
"actions": [
{
"id": "uid-start",
"type": "SE_Start",
"meta": {},
"controls": {},
"ports": {
"done": "uid-001"
},
@shinsaka
shinsaka / README.md
Last active June 16, 2022 09:44
AWS IAM Policy template for Amazon Connect Admin.

about

Amazon Connect管理者がAWSコンソールにログインする場合のポリシーを検討します

目標地点

  • AWSコンソールログインできる
  • 対象となるConnectインスタンス以外は操作できない
  • 対象となるConnectインスタンスのみ操作できる
  • 通話記録・チャット記録、エクスポートされたレポートを参照できる(S3)
@shinsaka
shinsaka / MyOnClickToDial.json
Last active March 21, 2022 03:24
Considering "DoNotCall" CTI FLOW Script for Amazon Connect CTI Adapter for Salesforce
{
"actions": [
{
"id": "0",
"type": "SE_Start",
"meta": {},
"controls": {},
"ports": {
"done": "1"
},
@shinsaka
shinsaka / lambda_function.py
Last active February 17, 2022 01:29
Amazon Lex V2 Response Utility Class
# usage in AWS Lambda:
from lexv2_utils import IntentBase
class MyIntentClass(IntentBase):
# Implements a behavior your bot.
def do_fulfillment(self) -> dict:
# Implements a your logic
message = {
'contentType': 'PlainText',
@shinsaka
shinsaka / AmazonConnectAgentEventFromKinesisStream.js
Last active September 3, 2021 05:04
Logging Sample for Amazon Connect Agent Event Stream by Lambda
exports.handler = async (event) => {
event.Records.map(({kinesis}) => {
const payload = Buffer.from(kinesis.data, 'base64').toString();
outputlog(JSON.parse(payload));
});
return {statusCode: 200};
};
function outputlog({EventType, EventTimestamp, CurrentAgentSnapshot}) {
if (EventType === 'HEART_BEAT') return;
@shinsaka
shinsaka / get_events.py
Last active March 28, 2024 06:06
Get all event messages of a group and stream from CloudWatch Logs AWS
import boto3
from datetime import datetime
def get_events(log_group_name, log_stream_name, region_name=None):
"""
Get all event messages of a group and stream from CloudWatch Logs AWS
"""
client = boto3.client('logs', region_name=region_name)
@shinsaka
shinsaka / getvalue.py
Created November 1, 2018 01:30
Get value from list of dict that has "Key" and "Value" key.
def getValue(key, items):
"""
Get value from list of dict that has "Key" and "Value" key.
"""
values = [x['Value'] for x in items if 'Key' in x and 'Value' in x and x['Key'] == key]
return values[0] if values else None
# 使用例
items = [{'Key': 'Name', 'Value': 'apple'},
@shinsaka
shinsaka / jsongenerator_sample.cls
Created September 19, 2017 03:35
using JSONGenerator with Apex/SFDC
Hoge p = new Hoge();
p.code = '0001';
p.name = 'hogename1';
p.items = new List<HogeItem>{
new HogeItem('0001-01', 'item001'),
new HogeItem('0001-02', 'item002')
};
JSONGenerator jg = JSON.createGenerator(false);
jg.writeObject(p);