Hi Team ,
Is it possible to send and receive events within copilot studio?
I would like to achieve a requirement using this. I don't want to trigger these events from outside of copilot.
I tried, but not able to receive that event sent from some topic within "event received trigger"
Event trigger topic:
Event received trigger:
Thank you for sharing this lead. I managed to retrieve the value passed by an event call. I'd like to highlight that it might result in an error if you only assign a value to Text(System.Activity.Value). Instead, you should specify the variable name.
store.dispatch({
type: 'DIRECT_LINE/POST_ACTIVITY',
meta: { method: 'keyboard' },
payload: {
activity: {
type: 'event',
name: 'sampleTriggerEvent',
value: { sampleInput: "This is a test" },
channelData: { postBack: true }
}
}
});
Based on the sample code provided, you need to use Text(System.Activity.Value.sampleInput) to properly retrieve the value in Copilot Studio.
Here is an example that parses a value passed by an event call. The value is assigned to System.Activity.Value.
kind: AdaptiveDialog
beginDialog:
kind: OnEventActivity
id: main
eventName: myEvent
actions:
- kind: SetVariable
id: setVariable_ZaaEfM
variable: Topic.myValue
value: =Text(System.Activity.Value)
Hi @argeraju , did you get this working?
I try something similar but have problems to get a proper response.
I have a similar question on receiving the event. I am sending the custom event from client webchat like below but how do i read the value in Copilot studio ?
store.dispatch( {
type: 'WEB_CHAT/SEND_EVENT',
payload:
{
name: 'EVENT_GET_POSITION',
value: { latitude: '12345', longitude: '09886', text:'I am new here' }
}
} );
Hi @argeraju
You can trigger topics using the event trigger. This is typically done from the client, using the Direct Line API.
For example, if you want to enter a specific topic directly from an API call (and not by a trigger phrase), one thing you can do is change the topic trigger to Event Received.
In the below example, I trigger my topic when I receive a “lesson1” event, and then redirect the conversation to the standard “Lesson 1” topic (that can also be triggered with trigger phrases):
From an API standpoint, I simply send an event activity to the Direct Line API: https://directline.botframework.com/v3/directline/conversations/{{ConversationId}}/activities
{
"type": "event",
"name": "lesson1"
}