Best answer

Extract values from Discord embed fields

  • 6 November 2021
  • 10 replies
  • 435 views

Hello everyone, 

 

I am new to zapier still learning. I am trying to extract values from Discord Embed and having no success in correctly separating the values. Here is Zap Link 

 

https://zapier.com/shared/4cc2a261ac7ca01a5963e7b6f23e6f7b6a458bbb

 

I am having hard time extracting original values as is in the embed message.

I am using , as separator with zap formatter to extract values but it messes my whole google sheet when there is a different number in embed message with more than 1 comma say 1,100 and 1,111,000 will mess up the whole formatting of the google sheet.

Is there a simpler way to just extract value from Discord embed message.

 

icon

Best answer by SamB 16 November 2021, 12:27

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

10 replies

Userlevel 7
Badge +11

Hey @StockNerd, welcome to the Community! 

We’re not able to view the Zap from the shared link, it essentially just makes a copy of the steps so some of the set up and configuration details aren’t present.

Could you take a screenshot for us showing how the embed values are sent over from Discord? (Please make sure to obscure and personally identifiable information before posting).

That said, it sounds like the issue that the values are being split by the Formatter step wherever there’s a comma, so when they are added to Google Sheets the values aren’t correct as they’ve been split up. Is that right?

If so, can you confirm if the embed values are sent from Discord as a comma separated list in a single field, or are they send over in multiple fields as line items? If you’re not sure, sending over a screenshot of the fields as they appear in the test sample on the Discord step should allow me to confirm this. Thanks! :)

Thank you @SamB 

 

You are absolutely right, I tried different formatting techniques but none solved the issue.

I am using , as seperator and it messes up the google sheet if there are extra commas.

Here is the snapshot of data I am receiving from discord.

 

 

And this is where it gets messed up, this value changes and if comma moves whole google sheet formatting is messed up.

 

 

I am hoping there is better way to extract these values. Thank in advance.

Userlevel 7
Badge +11

Thanks for posting those helpful screenshots, @StockNerd! :)

Hmm, it definitely looks like Discord is sending the values over as line items.

What you could try here is to use a Formatter (Utilities > Line-item to Text) step to separate the each of those values into separate fields that you can select individually. That action should ignore the commas within the numbers and keep them as “$1,185,000” rather than creating splitting them into “$1”, “185” and “000”.

Hopefully that will do the trick! 

I tried what you suggested and it did not work. Please see snapshots below

 

 

Here is the result

 

 

Userlevel 7
Badge +11

Thanks for giving that a try @StockNerd! I’m so sorry that didn’t work as hoped, it seems that they were actually nested line items that I didn’t spot from the previous screenshots.

Can you try setting the value in the Separator field on that Formatter step to be | like so:
668e83d232f16f9bfabc9aa70530bd81.png
That should then return the following in the text field when you retest that step: 
3:45 PM EST on November 5|2021|February 18| 2022|$250.00|CALL|$1,185,000 

If that works as I’m expecting, you can then follow that step up with a Formatter (Text > Split Text) step that uses | as the Separator and select All (as Separate Fields) for the Segment Index field to get them all output into separate fields.

Can you give that a try and let me know if that sorts it?

No luck still the same output :neutral_face:

This is the output 

 

Any other insight I can try. Thanks in advance.

Userlevel 7
Badge +11

Hey @StockNerd

Sorry for the delay in my reply here. I’ve since been doing a lot of experimenting with a nested array (from a Postman generated webhook not Discord) that produces a similar output to the one you’re receiving from Discord but am having the same issue. I even tried using a code step to try and split the items but the trouble is that it appears to be handled like a comma separated list of values rather than separate line items so the dollar amounts are always getting split incorrectly. :(

What we need here is a way to change the set up of the fields on Discord’s end so that they can be sent differently. Do you know if there’s a way to change the structure of the fields that are sent over from Discord? If not, is it was possible to append a special character to the start or end of each field value automatically then that would allow you to then split the values into separate fields using that character.

If neither of those is possible on Discord’s side then, sadly, it looks like we won’t be able to extract the values in the way that you’re after here.

I did some further looking into this and found that there’s an existing feature request to have a new Formatter transform to convert nested line item values into separate fields so I’ve added your vote for that! I don’t have an ETA or alternative workaround to suggest in the meantime but we’ll be sure to email you as soon as it’s been added. :)

@SamB  Thank you for the detailed reply.

 

I have no way of modifying the discord embed message on Discord end. I will wait for the feature update. Thanks