Integrations
Information on using Snowflake and Amazon Kinesis with Kustomer.Articles
Amazon Kinesis data streams
Kustomer gives you access to all your data inside and outside the platform. As an administrator, this is useful if you want to want to have full access to your organization's data in other business intelligence tools.Kustomer uses Amazon Kinesis to provide a data stream of all your events by forwarding these events to your own Kinesis stream, giving you access to all your data in real-time. Once you can access your events, you can manipulate and load your data into your desired tools. To learn more about the benefits, uses, and key ideas behind Kinesis Data Streams, see What is Amazon Kinesis Data Streams.Who can access this feature?User typesSee our pricing page for details on plan availability.In this articleAvailable dataSet up AWSContact Kustomer to complete the setupTroubleshootingAvailable dataThe following is a list of events that are published to the stream. Platform eventsBusiness rulesSearchShortcutsSnippets (Create/Update/Delete)UserUser authenticationTeamTagsCustomer eventsCompanyCustomerConversation (Create/Update/Delete/Update role group)Conversation (SLA breached)Conversation timeConversation moveConversation mergeCustomer mergeEvents (billing and app events)Forward emailKObjectsMessageMetadata (information regarding standard object and custom object fields)NoteShort link stats (Knowledge base)Tracking identifiedUser time (information on agent logged in)Routing eventsWork itemsWork sessionsSet up AWSInstalling the required AWS services via a CloudFormation service template script is the first step.Note: This service does not impact your API rate limits.Go here to download the service template script and save it as a .json file.Visit CloudFormation console, go to Create stack, and select With new resources (standard).Upload the service template script to CloudFormation. Enter a name for the new stack. The KustomerAccountId you can use in the template is based on your prod environment:Prod 1: 241254095402 (this ID is added to the template by default)Prod 2: 359686614991Note: We recommend you confirm which environment you are in to ensure that you're using the correct ID. You can do so by making an API request and reviewing the response header.Select Next to proceed to Step 4(Review).Review all of your information. Then, select the Acknowledge checkbox and Create stack.After 3-5 minutes, reload the CloudFormation Stacks page. When the “kustomer-stack” status shows CREATE_COMPLETE, select the Outputs tab. Here,, you will see some of the resources created via the CloudFormation template.Required services and roles will be created, along with an example Lambda function that outputs the events:Kinesis Role: KustomerDataStreamRoleKinesis Stream: kustomer-data-streamLambda Role: KustomerLambdaRoleLambda: kustomer-data-stream-fnContact Kustomer to complete the setupGo to the AWS Support Center to find your account ID, located in the upper right of the AWS Management Console. To complete the setup, email your ID and the region the account is in to support@kustomer.com.Once the setup is complete, events will be written to the Lambda Cloudwatch log. This gives you an example of how to process the events and what they look like. To view events:Select the Lambda service in the AWS console and navigate to the kustomer-data-stream-fn function. Select the Monitoring tab and then select the View logs in Cloudwatch button.You should now be able to select the latest log and view the data. You can process event data however you please, including updating and inserting the data into your business intelligence tools, such as Redshift.Note: Events from your data stream may not be in strict order. Many objects have a rev attribute to help you. You can compare different revisions and only update the latest one.TroubleshootingWhy can't I see my events?Events are only streamed going forward after activation, and historical data cannot be accessed before this point. If you plan to use this feature, ensure that the Kinesis data stream is turned on when your organization goes live to avoid any gaps in data access.Then, confirm that the cloud template has the required services correctly set up in AWS. If you're still having trouble, contact Kustomer Support for further assistance with troubleshooting.Why am I seeing duplicate events?Streaming event-based systems often function differently than developers might expect, so you should plan on spending extra time analyzing to diagnose any issues. For example, here's a typical event stream for a pizza order:Event 1Quantity: 1Type: Large cheese pizzaStatus: OrderedPrice: $29.99Event 2Status: CookedEvent 3Status: DeliveredIn the above example, if you scan through these events and only see Event 3 where the item is delivered, you might miss the other statuses in Event 1 and Event 2. Amazon offers best practices and troubleshooting recommendations in the AWS Developer Guide. Learn more in Amazon Kinesis Streams: Handling Duplicate Records.Snowflake data sharing
If you are using or considering Snowflake as your Business Intelligence (BI) solution, then you can utilize Kustomer's Snowflake data warehouse to access your data.Kustomer currently supports sharing with AWS users in the following regions: us-east-1us-west-2eu-west-1eu-central-1June 2023 update: This feature is no longer available to new customers.In this articleOverviewDataSnowflake Kustomer tablesTable definitionsExample queriesOverviewIf you want access to your Kustomer data to run your own analytics/reports, then Snowflake is a great solution as we can give you your data with minimal setup, using Snowflake's data sharing features.Currently, data is pulled from Kustomer every 10-15 minutes and copied to our Snowflake data warehouse. As soon as the data is in Snowflake, it should be available to you and ready to query. This service does not impact your API rate limits.DataAll of Kustomer's standard object data is available as well as additional lookup tables. The tables all have the same structure, although the data field holds specific semi-structured JSON data for the respective object.Snowflake Kustomer tablesEach table has the same structure - event data is stored as JSON in the DATA column. Here, you will find all the standard attributes of your data as well as any custom fields you may have set.Companies - standard object company dataREV {"type":"FIXED","precision":38,"scale":0,"nullable":true}DATA {"type":"VARIANT","nullable":true}UPDATED_AT {"type":"TIMESTAMP_NTZ","precision":0,"scale":9,"nullable":true}ID {"type":"TEXT","length":25,"byteLength":100,"nullable":false,"fixed":false}ORG {"type":"TEXT","length":25,"byteLength":100,"nullable":false,"fixed":false}IMPORTED_AT {"type":"TIMESTAMP_NTZ","precision":0,"scale":9,"nullable":true}Customers - standard object customer dataREV {"type":"FIXED","precision":38,"scale":0,"nullable":true}DATA {"type":"VARIANT","nullable":true}UPDATED_AT {"type":"TIMESTAMP_NTZ","precision":0,"scale":9,"nullable":true}ID {"type":"TEXT","length":25,"byteLength":100,"nullable":false,"fixed":false}ORG {"type":"TEXT","length":25,"byteLength":100,"nullable":false,"fixed":false}IMPORTED_AT {"type":"TIMESTAMP_NTZ","precision":0,"scale":9,"nullable":true}Conversations - standard object conversation dataREV {"type":"FIXED","precision":38,"scale":0,"nullable":true}DATA {"type":"VARIANT","nullable":true}UPDATED_AT {"type":"TIMESTAMP_NTZ","precision":0,"scale":9,"nullable":true}ID {"type":"TEXT","length":25,"byteLength":100,"nullable":false,"fixed":false}ORG {"type":"TEXT","length":25,"byteLength":100,"nullable":false,"fixed":false}IMPORTED_AT {"type":"TIMESTAMP_NTZ","precision":0,"scale":9,"nullable":true}Messages - standard object message dataREV {"type":"FIXED","precision":38,"scale":0,"nullable":true}DATA {"type":"VARIANT","nullable":true}UPDATED_AT {"type":"TIMESTAMP_NTZ","precision":0,"scale":9,"nullable":true}ID {"type":"TEXT","length":25,"byteLength":100,"nullable":false,"fixed":false}ORG {"type":"TEXT","length":25,"byteLength":100,"nullable":false,"fixed":false}IMPORTED_AT {"type":"TIMESTAMP_NTZ","precision":0,"scale":9,"nullable":true}Custom Objects (KObjects) - Data of any custom klasses you may have set up in KustomerREV {"type":"FIXED","precision":38,"scale":0,"nullable":true}DATA {"type":"VARIANT","nullable":true}UPDATED_AT {"type":"TIMESTAMP_NTZ","precision":0,"scale":9,"nullable":true}ID {"type":"TEXT","length":25,"byteLength":100,"nullable":false,"fixed":false}ORG {"type":"TEXT","length":25,"byteLength":100,"nullable":false,"fixed":false}IMPORTED_AT {"type":"TIMESTAMP_NTZ","precision":0,"scale":9,"nullable":true}Teams - lookup data for teamsREV {"type":"FIXED","precision":38,"scale":0,"nullable":true}DATA {"type":"VARIANT","nullable":true}UPDATED_AT {"type":"TIMESTAMP_NTZ","precision":0,"scale":9,"nullable":true}ID {"type":"TEXT","length":25,"byteLength":100,"nullable":false,"fixed":false}ORG {"type":"TEXT","length":25,"byteLength":100,"nullable":false,"fixed":false}IMPORTED_AT {"type":"TIMESTAMP_NTZ","precision":0,"scale":9,"nullable":true}Users - lookup data for usersREV {"type":"FIXED","precision":38,"scale":0,"nullable":true}DATA {"type":"VARIANT","nullable":true}UPDATED_AT {"type":"TIMESTAMP_NTZ","precision":0,"scale":9,"nullable":true}ID {"type":"TEXT","length":25,"byteLength":100,"nullable":false,"fixed":false}ORG {"type":"TEXT","length":25,"byteLength":100,"nullable":false,"fixed":false}IMPORTED_AT {"type":"TIMESTAMP_NTZ","precision":0,"scale":9,"nullable":true}Shortcuts - lookup data for any shortcuts you may have set up in KustomerREV {"type":"FIXED","precision":38,"scale":0,"nullable":true}DATA {"type":"VARIANT","nullable":true}UPDATED_AT {"type":"TIMESTAMP_NTZ","precision":0,"scale":9,"nullable":true}ID {"type":"TEXT","length":25,"byteLength":100,"nullable":false,"fixed":false}ORG {"type":"TEXT","length":25,"byteLength":100,"nullable":false,"fixed":false}IMPORTED_AT {"type":"TIMESTAMP_NTZ","precision":0,"scale":9,"nullable":true} Metadata - lookup data for any multi level lists or custom fields you have set up in KustomerREV {"type":"FIXED","precision":38,"scale":0,"nullable":true}DATA {"type":"VARIANT","nullable":true}UPDATED_AT {"type":"TIMESTAMP_NTZ","precision":0,"scale":9,"nullable":true}ID {"type":"TEXT","length":25,"byteLength":100,"nullable":false,"fixed":false}ORG {"type":"TEXT","length":25,"byteLength":100,"nullable":false,"fixed":false}IMPORTED_AT {"type":"TIMESTAMP_NTZ","precision":0,"scale":9,"nullable":true}Table definitionsThe REV field holds the revision of the record. It is here to ensure that we do not overwrite a record with older data as we sometimes cannot ensure that data comes in through in order.The DATA field holds the bulk of the data in a semi structured JSON format. A nice advantage of holding semi structured data this way is that if you add an additional custom field to an object it will automatically become available without having to update any schemas. The same is true for any custom objects you may have.The UPDATED_AT is the date the record was last updated.The ID field is the internal ID of the record.The ORG field is the internal organization ID within Kustomer. You will only see your org ID.The IMPORTED_AT field is when the record was copied to Snowflake and is for Kustomer reference.Example queriesTop 10 total messages sent by user:SELECT count(*) AS sent, u.data:name::string As name FROM messages m INNER JOIN users u ON m.data:createdBy = u.idWHERE m.data:createdBy IS NOT NULL GROUP BY u.data:nameORDER BY sent DESCLIMIT 10;Make requests to external API within Kustomer
Recommend pre-reading:Understanding Hooks Test and Debug Workflows Using Logs Klass Views Calling a Rest API within a workflow Kustomer Card SDK (for Option B only)There are two options for giving agents the ability to make requests to an external API with the press of a button.Option A - Klass View Embedded Workflow Button1. Create a workflow with a Form Hook following the instructions in “Understanding Hooks”.2. Create a new Klass View with a View Location of “Insights Panel Card”, Data Source of the Klass of object you want the button to appear on while viewing (we will use kobject.order for this example) and paste in this code:<Button onClick={() => { fetch( "HOOK_URL", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({kobject, customer}) } ); }} > Cancel </Button>HOOK_URL will be the URL of the Form Hook that you created in step 1.kobject and customer are JSON payloads representing of the timeline object and customer being viewed when the button is clicked.The resulting button in the timeline will look like this:3. We can now build out our workflow with a Rest API JSON step using the data submitted by the button. Use the Workflow Logger to inspect the JSON body of the data posted by the hook to build and troubleshoot your workflow.We can also add text inputs for agents to enter additional information before submitting. The input elements available are the standard HTML Form Elements. Use the JavaScript DOM getElementById method to pass the input value in the JSON payload posted to the form hook.<div> <div> <label>Reason</label><br/> <input id="cancel-reason"/> </div> <br/> <Button onClick={() => { fetch( "HOOK_URL", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ kobject, customer, cancellationReason: document.getElementById('cancel-reason').value, }) } ); }} > Cancel </Button> </div>Option B - iFrame embedded CardThis approach allows you to embed a context card using our Kustomer Card SDK. Using the SDK allows you to develop and host an HTML/JavaScript page to interact with Kustomer without using the Klass View editor. This SDK will allow your context card to easily fetch information about the customer/object currently being viewed in the Kustomer timeline and use it to render your card and make API requests. The main benefit to using the SDK over the Klass View editor is that developers can build the card within their own development environment and use their own dependencies instead of working within the Klass View Editor.Once your card/iFrame is created, your company will be responsible for hosting it. Once hosted, create a new Klass View with a View Location of “Insights Panel Card” and a Data Source of the Klass of object you want the iFrame to appear on while viewing. You can then embed the card following the instructions in our developer documentation to embed your iFrame: Kustomer Apps Platform: JSX in KustomerYour card can either make a direct call to an external API or post to a Kustomer Form hook to kick off a workflow as per Option A.
Still need help? Contact Us