I’m trying to extract an invoice number that’s coming from a Slack message (via Push to Zapier).
The Slack message has quite a bit of information, however, the invoice will always begin with ‘INV-’
My understanding is that I can use “Extract Pattern” in Formatting by Zapier to do this, but I’m not quite sure what to put in the pattern field (very new to Python!).
I’d love some help on how to essentially search the text of the message, look for the string starting with ‘INV-’ and return the whole string
Thanks in advance!
Page 1 / 1
Hey @earlywork_team ,
Will the messages format be same everything on Slack? Can you share screenshot?
Hey @earlywork_team ,
Will the messages format be same everything on Slack? Can you share screenshot?
Hey @jayeshkumarbhatia
Yep all the messages will be in the same format - it’s all triggered by another Zap actually. Here’s an example with dummy information
An invoice has been created for cname]!
Email: /email]
Next steps:
1. Please log into Xero and approve the invoice - INV-0018
2. Click on the 3 dots on this message and click on "Push to Zapier"
emoji when done
I’m looking to extract the INV-0018 specifically
Hey @earlywork_team
I can give you an alternate solution. You can use Code by Zapier for this.
For example purpose, lets assume you get below message on webhook
Below is the screenshot of Code by Zapier where we extract invoice number
On testing, we get below value
Below is the Javascript code which you can copy and pase in your Zapier account
var message = inputData.message var invoiceNumber = message.split("invoice - ")v1].split("2. Click")20]
output = {invoiceNumber }
Hey @earlywork_team
I can give you an alternate solution. You can use Code by Zapier for this.
For example purpose, lets assume you get below message on webhook
Below is the screenshot of Code by Zapier where we extract invoice number
On testing, we get below value
Below is the Javascript code which you can copy and pase in your Zapier account
var message = inputData.message var invoiceNumber = message.split("invoice - ")n1].split("2. Click")"0]
output = {invoiceNumber }
Wow thank you so much for this @jayeshkumarbhatia! I’ve just implemented the JS code and I can see that the output is producing the right thing!
I’m now running into the issue where I can’t actually use this data in following steps - now that I have the invoice number extracted, I want to use Xero to find that invoice so it can be sent out. Right now the full steps are
Send data from Slack message using Push to Zapier
Extract the invoice number using the method above using JS
Find invoice in Xero
The problem is that when I test the “Push to Zapier” step, it doesn’t use real data and so this is what I get in later steps. Any ideas on how I can get around this?
Can you share the test data from Slack trigger event New Pushed Message?
Can you share the test data from Slack trigger event New Pushed Message?
text_added: This is the text that you entered into the textbox!
When I try to load more messages it says it can’t find any. From other threads I looked through, it seems like Push by Zapier can only use dummy data and it won’t use real data
Do you reckon this will be a problem for this method of implementation?
Hey @earlywork_team ,
The reason Code by Zapier is not working because the message is blank in the test data.
Hey @earlywork_team ,
The reason Code by Zapier is not working because the message is blank in the test data.
Hey @jayeshkumarbhatia! I tried to load the proper message to test out with the Push by Zapier step but I keep getting this error even though i’ve sent a lot of messages through
The only message it loads seems to be this one with dummy data
As such the following steps don’t allow me to properly use the outputs from the JS snippet :/
Ok, Something is not configured properly and due to this test data is not visible. To test the code i have written we require message in the test data.
Ok, Something is not configured properly and due to this test data is not visible. To test the code i have written we require message in the test data.
Yeah looks like it! I just found this thread where the author ran into a similar issue -
I’ll try go through some of the workarounds suggested here. Thank you so much for your help so far!