Skip to content
On this page

Ingestion via DeepdeskSDK

It is also possible to ingest messages through the DeepdeskSDK. Potential use cases for this approach include conducting a Proof of Concept or when ingestion via webhook is not a viable option.

For the frontend integration, you will only need to utilize the upsertConversation function. This function serves to check whether the conversation already exists and then either loads it or creates a new one if necessary.

Example:

js
await deepdeskSDK.upsertConversation({
    sessionId: '1234',
    platform: 'awesome-chat-plaform',
    agentId: '5687',
});

After a conversation is loaded, use postMessages to post incomming messages to Deepdesk.

Messages undergo deduplication through the utilization of a message ID. Therefore, there is no need to be concerned about sending messages multiple times.

Example:

js
await deepdeskSDK.postMessages([
    {
        id: '1',
        source: 'visitor',
        authorId: '5678',
        text: 'Hi!',
        timestamp: '2023-07-25T11:43:55.308+00:00'
    },
    {
        id: '2',
        source: 'agent',
        authorId: '5678',
        text: 'Hello! How can I help you?',
        timestamp: '2023-07-25T11:46:12.529+00:00'
    },
]);

And don't forget to refresh the suggestions after the Deepdesk postMessages is called.

js
deepdeskSDK.refresh();