Execute POST/GET request from an Email Template and handlle response - node.js

there was an investigation task that was assigned to me by a collegue to check if it is possible to execute HTTP Requests and handle the response in the emails that we are sending. The emails are created using Mustache.js and we have buttons which call a GET request in the BE. To my understanding there is no way to execute JS in the email client as they do not allow it. Does anyone know if it is possible to send an http request and handle the response in the email client?

Related

How can i track that a mail is opened by the receiver or not using node js

I tried to use 1px,1px method but gmail blocks the response...
Can anyone help me to know that how can this be done...
I want to get the status that has the receiver opened the mail or not...
Simple steps you can follow to achieve this:
1. When you send a mail template add a js script in that
2. Call backend API from that script (using fetch)
3. Store the data in the database. (Request body)

Pass query parameter while making POST request from twilio webhook

When the call ends, I want to send data to Microsoft teams. For that purpose, I am making a POST request using the Twilio webhook. I have added the link for HTTP request in CALL STATUS CHANGES. But I also want to send data collected during calls. Is there any way to do that?
Article here(https://www.twilio.com/docs/usage/webhooks/voice-webhooks) doesn't mention anything about passing data.
My POST request URI looks something like this:-
https://xyz?Name=Himanshu&Phone=1234567890
I want Name and Phone data to be collected from Memory.
Twilio developer evangelist here.
When Twilio sends a webhook request about a voice call it will send a whole bunch of parameters including CallSid, To, From (the number user called from), AccountSid, CallStatus and more all of which are listed here.
I would not recommend making the Twilio webhook directly to Microsoft Teams as Twilio expects there to be a response to the request. Also, Twilio cannot know the name of your caller either.
Instead, I would recommend setting up the webhook request to go to your own application where you can parse out the data you need from the request, collect other data like name, and then make the request to Teams to complete your interaction.

How to send a POST request to irccat.etsy.com using Slack outgoing webhook

I am trying to replicate the FYI bot and I am stuck at the below step. I need help with the code on how to send a post request to irccat.etsy.com using slack outgoing webhook.
I was able to create outgoing webhook but I am not sure what to keep in URL and also how to send a post request to irccat.etsy.com
Step I am trying to implement:
"When the :fyi: reacji is added to a Slack message (or the ?fyi irccat command is used), an outgoing webhook sends a POST request to irccat.etsy.com with the message details. This triggers a PHP script to save the message text to a SQLite database, and sends an acknowledgement back to the Slack incoming webhook endpoint. The acknowledgement says “OK! Added your FYI”, so the user knows their FYI has been successfully added to the database.
This App cannot be implemented using Events API so below is how I configured the Outgoing webhook. Outgoing Webhook
I need lead to use URL of outgoing Webhook and generate a post request to irccat.etsy.com
you can refer this: https://realpython.com/getting-started-with-the-slack-api-using-python-and-flask/
its like:
Add a new function under channel_info named send_message:
def send_message(channel_id, message):
slack_client.api_call(
"chat.postMessage",
channel=channel_id,
text=message,
username='pythonbot',
icon_emoji=':robot_face:'
)
send_message takes in the ID for a channel, then posts a message from our “Python bot” to that channel. In addition, modify the main function so that when we run this file, main will call our new send_message function:

Twilio SMS reply in node.js

I'm writing a mobile notification system using twilio in node.js and I am currently able to send SMS messages to users. But I would like users to reply back with a response. I would need to gather the phone number the user sent the text from as well as the contents of the message (to query my mongoosedb)
I couldn't find much info on this so any help is appreciated.
Twilio evangelist here.
Check out this blog post which introduces you to our Node helper. If you scroll down to the section titled "Generating TwiML to handle inbound calls and SMS", it will walk you through receiving an SMS message from Twilio.
The basic idea is that when your user replies to your message, Twilio is going to tell you that by making an HTTP request to some URL that you have configured for your Twilio phone number. That URL is some endpoint that you have created in your Node app.
As part of that request, Twilio is going to pass some form parameters to you. In your going to use the request object that is passed into the POST function to get the parameters that Twilio passes you:
console.log(request.body.from);
console.log(request.body.to);
Heave over to this page on our website to see all of the parameters Twilio will send you when we
Hope that helps.

How to receive the emails using mailgun in node.js

In my application im using mailgun module to send and receive emails using node.js.I don't know how to receive the incoming emails.I created route to receive the incoming email.but its not working.
Mailgun is simply posting URL encoded form data.
Check out this discussion on receiving POST data in node.js: How do you extract POST data in Node.js?
Also it's worth noting that for whatever mail-header-related reasons, if you have mailgun set to forward something to a#b.com, then messages sent from a#b.com will not show up back in your inbox. Send mail from a different address. Note that mailgun can sometimes tell if you're using the Send As feature in gmail, and will know your main address.

Resources