GithubHelp home page GithubHelp logo

plugin-email's Introduction

Twilio Flex / SendGrid Email Integration Example

<>

Setting up SendGrid

  • You'll need to authenticate your domain
  • Then point your MX record to mx.sendgrid.net
  • Configure the inbound parse webhook to point at your application. If using ngrok like me, it should look like https://yourtunnel.ngrok.io/inbound.
    • Note: Twilio Functions are currently not compatible with the inbound parse webhook
  • Generate a SendGrid API Key here and note it down

Configuring Twilio Flex

  • Navigate to your TaskRouter Workspace (it should be named Flex Task Assignment), then to Task Channels and create a new Task Channel named Email.

  • Create an email Flex Flow

You'll need your webhook URL handy, in this quickstart I will use ngrok in this example. You'll also need your ChatServiceSid which can be found here.

Run the following curl:

curl -X POST https://flex-api.twilio.com/v1/FlexFlows \
  --data-urlencode 'ChannelType=custom' \
  --data-urlencode 'Enabled=true' \
  --data-urlencode 'ContactIdentity=null' \
  --data-urlencode 'IntegrationType=external' \
  --data-urlencode 'Integration.Url=https://yourtunnel.ngrok.io/flexflow' \
  --data-urlencode 'FriendlyName=Email FlexFlow' \
  --data-urlencode 'ChatServiceSid=ISxxxxxxxxx' \
  --data-urlencode 'LongLived=true' \
  -u ACxxxxxxxx:[AUTH_TOKEN]

This should yield a Flex Flow Sid like FOxxxxxxxxx -- note it down.

Setting up your webhook

Hopefully you've already cloned this repository and ran npm install. Next:

If you followed the steps above correctly, sending an e-mail should now yield some logs and a task within Flex.

inbound screenshot

Of course, Flex doesn't know how to render tasks for our new e-mail channel yet, so we can't see the contents. For that, let's add a plugin!

Building the plugin

In the root of the plugin-email directory execute

  • npm install
  • npm run build

Then upload the resulting distribution file to Twilio Assets.

It should now look like this:

Flex Email UI

Changing the URL of your server

If you find yourself wanting to update the URL for your express server, you'll need to update the URL in two places:

curl -X POST https://flex-api.twilio.com/v1/FlexFlows/FOxxx \
  --data-urlencode 'Integration.Url=https://yourtunnel.ngrok.io/flexflow' \
  -u ACxxxxxxxx:[AUTH_TOKEN]

Authors

  • Martin Amps
  • Trenton McManus

Disclaimer

This software is to be considered "sample code", a Type B Deliverable, and is delivered "as-is" to the user. Twilio bears no responsibility to support the use or implementation of this software.

plugin-email's People

Contributors

dorkusprime avatar martinamps avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

plugin-email's Issues

Update for Flex UI 2.0

Thanks for this great example - any chance we can get an updated version of this for Flex UI 2.0? I'm trying myself but would be great to have a sample to start with

See Email

Hi ! I trying view the email in Twilio Flex with the plugin.

I can receive the email,
receive email

but when wanting to open the mail, it fails
view email

I configurate the .env.example and whit it data create the file .env, and configurate the appConfig.js

how can I view the email ?

question.

Hello I'm trying implement your plugin. I have a couple question about it. What do you mean with "Run the following curl" step two of this tutorial. Thanks for the help

.ENV FILE

info
Hello , I'va one question about the variarable FLEX_FLOW_SID=????? on the file .env what suppose to be thhe value of this variable?and how can I get it?, thanks for you help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.