Adding Amazon Kinesis Integration in Pendula

Angel Cheung
Angel Cheung
  • Updated

Quick links

What does the Amazon Kinesis Integration enable?

How to add the integration into Pendula


 

What does the Amazon Kinesis Integration enable?

Adding the Amazon Kinesis Integration into Pendula will enable the Amazon Kinesis trigger node to be used, and flow activity (aka 'Activity Sync') to be recorded and transmitted between Pendula and Amazon Kinesis. 

Activity sync

Activity sync, enabled by integrating Amazon Kinesis into Pendula, records important events of a triggered flow such as email or SMS content, message delivery and sent times. This data is then written into Amazon Kinesis, where it can also be read from there.

Below is the type file for the events passed across the Activity Sync:

/**
* Common types
*/
type Address = string;
type MessageId = string;
type ExperienceId = string;
type Instant = string;

type EmailPayload = {
kind: "email"
sender: Address;
recipient: Address;
subject: string;
body: string;
replyTo?: string;
}

type SmsPayload = {
kind: "sms"
sender: Address;
recipient: Address;
body: string;
}

type MessagePayload = EmailPayload | SmsPayload;

type ActivitySyncError = {
errorMessage: string
errorCode?: string
}

type ExperienceContext = {
experienceId: string
}

type FlowContext = {
flowId: string
flowName: string
flowVersion?: number
}

type NodeContext = {
nodename: string
}

type WorkflowContext = {
experienceContext: ExperienceContext
flowContext: FlowContext
nodeContext?: NodeContext
}

type CustomContext = {
[key: string]: any
}

/**
* Integration Inbound types
*/
type KinesisTriggerRecord = {
payload: any
customContext: CustomContext
}

/**
* Integration Outbound types
*/
type OnMessageQueued = {
kind: 'queued'
messageId: MessageId
payload: MessagePayload
timestamp: Instant
workflowContext?: WorkflowContext
customContext: CustomContext
}

type OnMessageValidationFailed = {
kind: 'validation-failed'
messageId: MessageId
errors: ActivitySyncError[]
timestamp: Instant
workflowContext?: WorkflowContext
customContext: CustomContext
}

type OnMessageSentToGateway = {
kind: "sent-to-gateway"
messageId: MessageId
timestamp: Instant
workflowContext?: WorkflowContext,
customContext: CustomContext
}

type OnMessageRejectedByGateway = {
kind: "rejected-by-gateway"
messageId: MessageId
errors: ActivitySyncError[]
timestamp: Instant
workflowContext?: WorkflowContext,
customContext: CustomContext,
}

type OnMessageDelivered = {
kind: "delivered"
messageId: MessageId
timestamp: Instant
workflowContext?: WorkflowContext,
customContext: CustomContext,
}

type OnMessageBounced = {
kind: "bounced"
messageId: MessageId
errors: ActivitySyncError[]
timestamp: Instant
workflowContext?: WorkflowContext,
customContext: CustomContext,
}

type OnMessageOpened = {
kind: "opened"
messageId: MessageId
timestamp: Instant
workflowContext?: WorkflowContext,
customContext: CustomContext,
}

type OnInboundMatchedIntent = {
kind: 'inbound-matched-intent'
messageId: MessageId
parentMessageId?: string
matchedIntentKey: string
timestamp: Instant
workflowContext?: WorkflowContext,
customContext: CustomContext,
}

type OnInboundUnmatched = {
kind: 'inbound-unmatched'
messageId: MessageId
payload: MessagePayload
timestamp: Instant
workflowContext?: WorkflowContext,
customContext: CustomContext,
}

type OnExperienceStart = {
kind: 'experience-start'
experienceId: ExperienceId
timestamp: Instant
workflowContext?: WorkflowContext,
customContext: CustomContext
}

type OnExperienceFinish = {
kind: 'experience-finish'
experienceId: ExperienceId
timestamp: Instant
outcome: any
workflowContext?: WorkflowContext,
customContext: CustomContext
}

type OnExperienceFailed = {
kind: 'experience-failed'
experienceId: ExperienceId
timestamp: Instant
workflowContext?: WorkflowContext,
customContext: CustomContext
errorDetails: ActivitySyncError[]
}

 

Amazon Kinesis Trigger Node

This node allows you to initiate a flow via the Kinesis stream. It transmits data (aka 'payload') from the Amazon Kinesis data stream into your flow.

Learn more about using the Amazon Kinesis Trigger Node in Pendula here

Below is the type file for the Kinesis Trigger record:

import { CustomContext } from "../context"

type KinesisTriggerRecord = {
payload: any
customContext: CustomContext
}

How to add the integration into Pendula

Kapture_2022-06-01_at_16.50.45.gif

Follow the steps below to add Amazon Kinesis into Pendula:

1. Login to your Pendula tenant.

2. Navigate to Integrations screen.

3. Select Amazon Kinesis integration under the Add New section.

4. Input a unique API Name (required) and description (optional).

5. Input your AWS Access Key ID and AWS Secret Access Key of your data stream from your AWS Management Console. 

6. Click Save Integration. You can now use the Amazon Kinesis trigger node in your flows.