Send automatic answer email

Hello dear all,

I am trying to send an automatic answer email on my app and I did not find anything already done in the forum neither in the function market.

Searching online, I found this post that explain a way to send automatic emails using javascript and I was able to make it work in HTML: https://pepipost.com/tutorials/how-to-send-emails-with-javascript/

The problem is that I have very little knowledge of programming, and when I tried to copy and paste the code below to the javascript node function on appgyver, it did not work.

HTML code working:

Java script node not working:

I think this is probably something simple to solve and that can help others who have the same issue.

Thank you all, you are awesome!

Hi,

Can’t help on the Java code, but you could also explore another approach.

You could use HTTP request to send content of email in JSON to your account in SendGrid or MailJet.

Another simpler approach could be also to create Integromat webhook and connect it to Gmail inside of Integromat (in case of low email volume).

1 Like

Yes, Thank you for the tip, but I also would like to know what is going wrong in the JS code.

This is the first time that I am trying to do something with the JS node and it is frustating not knowing what is the problem, because next time that I face the same problem, I will again get stuck on it.

Javascript errors are emited to the console which you can use to debug, also using console.log can help you to pinpoint your error. It’s just plain javascript ran in the browser, nothing magic.

Hello @Greg_F and @Sasu_Makinen,

I tried to use sendgrid and mailjet, but they work in cURL, PHP, NODE, RUBY, PYTHON, GO, C#, and JAVA.
I still can’t figure it out how to setup all the post request in appgyver as the information on, for example, MailJet API documentation is different from the one available on appgyver.

I got confused because both SendGrid and MailJet API documentation says that I have to have cURL installed on my machine or use an official library.
How is this supposed to work? I am totally lost here…

MailJet doc: https://dev.mailjet.com/email/guides/getting-started/

Appgyver API:

Can you help me understanding and informing what should I put on relative path, response key path and if I need to use a HTTP Header, URL placeholder and Query parameter?

Thank you.

@Sasu_Makinen :rofl: right… once you are a level 3 wizzard… For common folk it is a pure trickery … :rofl: :rofl:

@Meu_Porteiro

cURL is just a piece of software that you use to make HTTP requests.

BTW your browser is also a software that does HTTP requests… cURL just helps to add more parameter to the HTTP request.

To send your email via SendGrid or MailJet you need to make a HTTP .

Appgyver is making also HTTP requests in at least 3 ways:

  1. via Rest API data module - but this should be used when you expect to recieve data as response to your HTTP request and further use this data in your app
  2. via HTTP request module in components - this is probably what you should use
  3. via JS block when you can code the request yourself (using fetch () command )

To know you what parameters to use for the request you use cURL syntax as quide:

  1. Request path (or target URL or just URL
    image
  2. type of request
    POST (as on picture above)
  3. headers
    image
  4. Json body of the message
  5. looks like there is also authentication needed using your private and public key
    image
    @Sasu_Makinen Can appgyver http request component add user for authentication?
1 Like

If above doesnt work, you can make HTTP request to Mailjet using fetch() in JS component and above parameters.

Here are details of using fetch:

Hello @Greg_F,

Thank you for the explanation.
My issue was that I didn’t know the existence of the HTTP request module in components.

Now, it is working perfectly.

Best regards.

1 Like