Created
October 26, 2018 05:55
-
-
Save m-ammar/cf945d5795d98dbdb869b1e0ecf26aac to your computer and use it in GitHub Desktop.
This shell script can be used to get
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
emailToExtractOtacFrom=$1 | |
emailToSendMagicLinkTo=$2 | |
otacValue=$(curl -s https://aws-sns-stub.dev.moneynp.xinja.com.au/aws-sns-stub/email/address/$emailToExtractOtacFrom | jq '.[0].message.body.html.data' | grep otac= | awk -F 'otac=' '{print $2}' | cut -d "\\" -f 1) | |
emailBodyText='Magic Link ==>> ' | |
emailBodyMagicLink=https://native-support.dev.moneynp.xinja.com.au/information/install?otac=$otacValue | |
curl -s --user 'api:79c45e782acba502516875093739f9b6-4836d8f5-68302a5e' \ | |
https://api.mailgun.net/v3/sandbox8986c735df494cef9b27bf1164919583.mailgun.org/messages \ | |
-F from='Mailgun Sandbox <postmaster@sandbox8986c735df494cef9b27bf1164919583.mailgun.org>' \ | |
-F to=$emailToSendMagicLinkTo \ | |
-F subject='Xinja Magic Link' \ | |
-F text=$emailBodyText$emailBodyMagicLink | |
# How to use: | |
# ./getOtacOverEmail.sh <<email_to_which_otac_was_sent>> <<email_to_which_magic_link_should_be_sent>> | |
# Replace the values marked by <<>> with the respective emails. The otac will be extracted FOR the FIRST email value and sent to the SECOND email value. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment