Slack integration-Extract message from slack

Hey @Yesodha_Karuppusamy

Perfect, cool :slightly_smiling_face::+1:

Thanks
#nK

1 Like

Hi now i am trying for sending the first 15 messages. do u have any idea?

1 Like

Hey @Yesodha_Karuppusamy

Anyway, the Get messages activity is returning you a list of messages !

You can pick the latest 15 right ? May be take function should help.

Thanks
#nK

yes. i am trying

1 Like

Okay @Yesodha_Karuppusamy

Feel free to post if any challenges !

1 Like

@Nithinkrishna sure

1 Like

Hi @Nithinkrishna i am not getting idea…kindly help me to extract the first 15 messages.

Hey @Yesodha_Karuppusamy

Could you please show the Get Messages output variable in the locals panel while you debug, First step is to check how its giving us data to get the 15 messages !

Thanks
#nK

image

I am getting all the messages which are present in the channel

1 Like

Hey @Yesodha_Karuppusamy

You are getting 2 messages or all now ?

Also, could you please show the Locals menu by debugging because it will help us to understand the object type and props to fetch the message ?

Thanks
#nK

Hey @Yesodha_Karuppusamy

It’s been giving you 636 messages which is cool.

The object type I’m seeing here is Message[]

So you should now pass the object in For-Each as Get_OutMessages.Take(5)

This should print the top 5 messages, Kindly check if that helps.

Thanks
#nK

1 Like

will try and let u know

In loop is taking only first 5 messages but on copying is copying only one message.
My boss told that u read one by one and group together to copy the messsage

1 Like

Hey @Yesodha_Karuppusamy

Okay I got your point → You want to combine all the latest 5 messages into one & send to other channel. Is that correct ?

Thanks
#nK

yes ur right

Hey @Yesodha_Karuppusamy

  1. Remove the For-each

  2. Once you get the messages from the GET activity, just pass the below statement in Message Text property of send

//Joining the latest 5 messages into one string separated by comma

String.Join(",", Get_OutMessages.Take(5).Select(Function(msgObj) msgObj.Text))

//String.Join(<separator>, collection)

If you need a different separator just update the first argument

Hope this helps.

Thanks
#nK

@Nithinkrishna thanks, i will try and let u know.

Sure @Yesodha_Karuppusamy

So just to iterate, you will be now having one Get Messages activity and one Send Messages activity.

Thanks
#nK

yes ur rite