cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Code-based Actions: Send a confirmation email

Code-based Actions: Send a confirmation email

Confirm a received message by email to your user

In some cases, you might want to send an email to your customer of confirmation of receipt by email. A common example is when your chatbot creates a ticket in a CRM tool like Salesforce, Zendesk or Hubspot and you confirm that the ticket is received by email.

In this guide we show you how to:

  1. Check if we have the customers email address
  2. If not, ask and extract the email address
  3. If the customer doesn't provide a valid email address, ask again
  4. Send confirmation of receipt by email to the customer

1. Check if we have the customers email address

The first step is to check if we have the customers email address. We can do that by using the Condition trigger. Drag and drop it onto your canvas. The branch that you see will behave as an if/else statement.

If param email exists continue with the first branch, else, follow up with the second branch. For more info regarding conditions, have a look here.

emailconf1.png

2. If not, ask and extract the email address

Let's say we don't have the customers' email address yet and the bot will continue with the second branch. That is the moment to ask and extract the email address. We do that by using the Any Text trigger. In this example, the name of the parameter is "email". In the right pane, you can select that this parameter should be an email address.

 

emailconf2.png

 

3. If the customer doesn't provide a valid email address, ask again

Drag and drop a second any text next to Any text that should be an email. This parameter will be filled whenever the user input is not a valid email address. From there on we can loop back to the event on top.

Tip: provide an option to head back to a menu or intro to prevent customers from being stuck the flow.

 

emailconf3.png

4. Send confirmation of receipt by email to the customer

Now, we've received the customer's e-mail address and we can use an Action to send an e-mail from the Flow Platform (supported at Pro and Enterprise Plans).

 

emailconf4.png

 

Drag and drop an Action onto your canvas. You can copy and paste the code below as an example.

async payload => {
  
  let emailadres = "-"
  
  if(Array.isArray(payload.params.email)) {
    emailadres = payload.params.email[0].value
  }
  
  //console.log(emailadres)

  toolbelt.email({
    to: emailadres,
    subject: 'Hello from Flow.ai', 
    message: `Hi and thank you for your message. Someone from flow.ai will get back to you as soon as possible. - Flow.ai Team`
  })
  
}

You can verify the process by using the try it out. You should receive an email in your inbox.

 

emailconf5.png

 

Labels (1)

Code-based Actions: Send a confirmation email

Confirm a received message by email to your user

In some cases, you might want to send an email to your customer of confirmation of receipt by email. A common example is when your chatbot creates a ticket in a CRM tool like Salesforce, Zendesk or Hubspot and you confirm that the ticket is received by email.

In this guide we show you how to:

  1. Check if we have the customers email address
  2. If not, ask and extract the email address
  3. If the customer doesn't provide a valid email address, ask again
  4. Send confirmation of receipt by email to the customer

1. Check if we have the customers email address

The first step is to check if we have the customers email address. We can do that by using the Condition trigger. Drag and drop it onto your canvas. The branch that you see will behave as an if/else statement.

If param email exists continue with the first branch, else, follow up with the second branch. For more info regarding conditions, have a look here.

emailconf1.png

2. If not, ask and extract the email address

Let's say we don't have the customers' email address yet and the bot will continue with the second branch. That is the moment to ask and extract the email address. We do that by using the Any Text trigger. In this example, the name of the parameter is "email". In the right pane, you can select that this parameter should be an email address.

 

emailconf2.png

 

3. If the customer doesn't provide a valid email address, ask again

Drag and drop a second any text next to Any text that should be an email. This parameter will be filled whenever the user input is not a valid email address. From there on we can loop back to the event on top.

Tip: provide an option to head back to a menu or intro to prevent customers from being stuck the flow.

 

emailconf3.png

4. Send confirmation of receipt by email to the customer

Now, we've received the customer's e-mail address and we can use an Action to send an e-mail from the Flow Platform (supported at Pro and Enterprise Plans).

 

emailconf4.png

 

Drag and drop an Action onto your canvas. You can copy and paste the code below as an example.

async payload => {
  
  let emailadres = "-"
  
  if(Array.isArray(payload.params.email)) {
    emailadres = payload.params.email[0].value
  }
  
  //console.log(emailadres)

  toolbelt.email({
    to: emailadres,
    subject: 'Hello from Flow.ai', 
    message: `Hi and thank you for your message. Someone from flow.ai will get back to you as soon as possible. - Flow.ai Team`
  })
  
}

You can verify the process by using the try it out. You should receive an email in your inbox.

 

emailconf5.png

 

Labels (1)
Last Reviewed:
02-23-2022 04:25 PM

Code-based Actions: Send a confirmation email

Confirm a received message by email to your user

In some cases, you might want to send an email to your customer of confirmation of receipt by email. A common example is when your chatbot creates a ticket in a CRM tool like Salesforce, Zendesk or Hubspot and you confirm that the ticket is received by email.

In this guide we show you how to:

  1. Check if we have the customers email address
  2. If not, ask and extract the email address
  3. If the customer doesn't provide a valid email address, ask again
  4. Send confirmation of receipt by email to the customer

1. Check if we have the customers email address

The first step is to check if we have the customers email address. We can do that by using the Condition trigger. Drag and drop it onto your canvas. The branch that you see will behave as an if/else statement.

If param email exists continue with the first branch, else, follow up with the second branch. For more info regarding conditions, have a look here.

emailconf1.png

2. If not, ask and extract the email address

Let's say we don't have the customers' email address yet and the bot will continue with the second branch. That is the moment to ask and extract the email address. We do that by using the Any Text trigger. In this example, the name of the parameter is "email". In the right pane, you can select that this parameter should be an email address.

 

emailconf2.png

 

3. If the customer doesn't provide a valid email address, ask again

Drag and drop a second any text next to Any text that should be an email. This parameter will be filled whenever the user input is not a valid email address. From there on we can loop back to the event on top.

Tip: provide an option to head back to a menu or intro to prevent customers from being stuck the flow.

 

emailconf3.png

4. Send confirmation of receipt by email to the customer

Now, we've received the customer's e-mail address and we can use an Action to send an e-mail from the Flow Platform (supported at Pro and Enterprise Plans).

 

emailconf4.png

 

Drag and drop an Action onto your canvas. You can copy and paste the code below as an example.

async payload => {
  
  let emailadres = "-"
  
  if(Array.isArray(payload.params.email)) {
    emailadres = payload.params.email[0].value
  }
  
  //console.log(emailadres)

  toolbelt.email({
    to: emailadres,
    subject: 'Hello from Flow.ai', 
    message: `Hi and thank you for your message. Someone from flow.ai will get back to you as soon as possible. - Flow.ai Team`
  })
  
}

You can verify the process by using the try it out. You should receive an email in your inbox.

 

emailconf5.png

 

Labels (1)
Version history
Last update:
‎06-19-2021 11:14 AM
Updated by:
Contributors