How to use the botframework-schema.ActivityTypes.EndOfConversation function in botframework-schema

To help you get started, we’ve selected a few botframework-schema examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / botbuilder-js / libraries / simple-bot-to-bot / simple-root-bot / rootBot.js View on Github external
this.onUnrecognizedActivityType(async (context, next) => {
            // Handle EndOfConversation returned by the skill.
            if (context.activity.type === ActivityTypes.EndOfConversation) {
                // forget skill invocation
                this.activeSkillProperty.set(context, undefined);

                // We are back at the root
                await context.sendActivity('Back in the root bot. Say \'skill\' and I\'ll patch you through');

                // Save conversation state
                await this.conversationState.saveChanges(context, true);
            }

            // By calling next() you ensure that the next BotHandler is run.
            await next();
        });
github microsoft / botframework-solutions / lib / typescript / botbuilder-skills / src / http / skillHttpTransport.ts View on Github external
skillResponses.forEach(async (skillResponse: Activity) => {
            // Once a Skill has finished it signals that it's handing back control to the parent through a
            // EndOfConversation event which then causes the SkillDialog to be closed. Otherwise it remains "in control".
            if (skillResponse.type === ActivityTypes.EndOfConversation) {
                endOfConversation = true;
            } else if (skillResponse.name === TokenEvents.tokenRequestEventName) {
                if (tokenRequestHandler) {
                    await tokenRequestHandler(skillResponse);
                }
            } else {
                // Trace messages are not filtered out and are sent along with messages/events.
                filteredResponses.push(skillResponse);
            }
        });
github microsoft / BotFramework-Emulator / packages / app / client / src / ui / editor / emulator / parts / chat / chat.spec.tsx View on Github external
it('should render nothing at the end of conversation', () => {
      wrapper = shallow();
      const middleware = card =&gt; children =&gt; <div>{children}</div>;
      const mockCard = { activity: { type: ActivityTypes.EndOfConversation, valueType: ValueTypes.Activity } };
      const activityWrapper = (wrapper.instance() as any).createActivityMiddleware()(middleware)(mockCard)(<span>);
      expect(activityWrapper).toBe(null);
    });
</span>
github microsoft / BotFramework-Emulator / packages / app / client / src / ui / editor / emulator / parts / chat / chat.tsx View on Github external
private createActivityMiddleware = () => next => card => children => {
    const { valueType } = card.activity;

    this.activityMap[card.activity.id] = valueType === ValueTypes.Activity ? card.activity.value : card.activity;

    switch (card.activity.type) {
      case ActivityTypes.Trace:
        return this.renderTraceActivity(next, card, children);

      case ActivityTypes.EndOfConversation:
        return null;

      default:
        return this.activityWrapper(next, card, children);
    }
  };