How I can get slack user name?

I want to get the slack user name, how I can get it?

Thank in advance.

Hey @luisbattle!

The Slack user’s information is available in the incoming event’s payload. Here is an example of an incoming event that is generated by Botpress whenever a message is sent from a Slack user to your Slack application:

IOEvent {
  type: 'text',
  channel: 'slack',
  direction: 'incoming',
   { client_msg_id: '5f8f765e-7c90-46ca-ab0b-8c5bb79d163a',
     suppress_notification: false,
     type: 'text',
     text: 'hello',
     user: 'USMLYGZ4G',
     team: 'TSBET5WRF',
     blocks: [ [Object] ],
     source_team: 'TSBET5WRF',
     user_team: 'TSBET5WRF',
     channel: 'DSA7YGXRR',
     event_ts: '1583854122.000600',
     ts: '1583854122.000600',
      { id: 'USMLYGZ4G',
        team_id: 'TSBET5WRF',
        name: 'simon.pierre.gingras_',
        deleted: false,
        color: '9f69e7',
        real_name: 'Simon-Pierre',
        tz: 'America/New_York',
        tz_label: 'Eastern Daylight Time',
        tz_offset: -14400,
        profile: [Object],
        is_admin: true,
        is_owner: true,
        is_primary_owner: true,
        is_restricted: false,
        is_ultra_restricted: false,
        is_bot: false,
        is_app_user: false,
        updated: 1579012996 } },
  target: 'USMLYGZ4G',
  botId: 'slackbot',
  createdOn: 2020-03-10T15:28:42.621Z,
  threadId: 'DSA7YGXRR',
  id: '158385412262166050',
  preview: 'hello',
  flags: {},
   { __stacktrace: [],
     user: { '0': '{', '1': '}' },
     context: {},
     session: { lastMessages: [Array], slots: {} },
     temp: {},
     bot: undefined },
  suggestions: [],
  credentials: undefined,
   { entities: [],
     language: 'n/a',
     detectedLanguage: 'n/a',
     ambiguous: false,
     slots: {},
     intent: { name: 'none', confidence: 1, context: 'global' },
     intents: [],
     errored: false,
     includedContexts: [ 'global' ],
     ms: 0 } } 

Hope this helps!

1 Like

THANKS!!! I got the user! :wink:

Is there anyway you can get slack user info inside flows page? @spgin