I have a couple of questions, to be more specific,...
# 💻developers
a
I have a couple of questions, to be more specific, two questions. We are developing a custom integration for some customers, and I couldn't find any information in the documentation. I tried posting on the Discord help channel yesterday, but I haven't received any response. Can you assist me with these? 1. How can I obtain the conversation ID within an action in an integration? Is there a way to do this? 2. What does the "ack" prop exposed inside the actions refer to? I know ack is a function that I can pass tags, but what is the purpose of doing this?
j
Obtaining the Conversation ID Within an Action: In Botpress, when you're working within an action, you can access the conversation ID through the event object. The event object contains various properties about the current event, including the conversation ID. Here's how you can access it:
const conversationId = event.conversationId;
This line of code assigns the conversation ID to the conversationId variable, which you can then use within your action to perform various tasks, such as logging, fetching conversation-specific data, or making API calls that require the conversation ID.
Understanding the "ack" Prop Exposed Inside Actions: The "ack" property (short for acknowledgment) within actions in Botpress is typically used to acknowledge that an event or a specific operation has been processed or handled. It can be particularly useful in scenarios involving asynchronous operations or when integrating with external systems that require confirmation once a message is received or processed. The purpose of passing tags to the ack function can vary based on the specific implementation or integration requirements. Generally, it's used to provide additional context or metadata about the acknowledgment. For example, you might use tags to categorize the acknowledgment, indicate the status of processing, or provide identifiers that link the acknowledgment to specific actions or outcomes in your system. Here's a conceptual example of using the ack function within an action:
async function handleEvent(event, { ack }) { try { // Perform some operations here, like calling an external API // Once done, acknowledge the event processing is complete ack('processed', { tag1: 'value1', tag2: 'value2' }); } catch (error) { // In case of an error, you might want to acknowledge with a different tag or status ack('error', { errorMessage: error.message }); } }
In this example, the ack function is used to signal the completion of event processing, with tags providing additional context.
@fresh-fireman-491
this is the bots answer.
f
Ohh nice
j
Remo (sorry for the ping) your names under Decay so i pinged you on accedint
c
All good, actually learned something useful thanks 😜
j
really ?
lol no problem
c
yes ! the "ack" property was completely new to me. So if im understanding correctly we can assign tags to events (conversation IDs) using "ack" properties ?
j
i have no idea.
That was my bots answer
i built a chatbot that creates threads and asnwers people
c
really cool yet we should be cautious about taking GPT's word for granted. Ive noticed it still hallucinates allot of times
it might very well be that "ack" properties are fake 😄