You’ve got your bots working on Zwerm, and all is going well. But now you want to send an email with Dialogflow, and you’re finding yourself stuck. Worry no more – here we have a quick and easy step by step guide to walk you through it.
Step 1: Create a new intent
Create a new intent in Dialogflow (you should be familiar with this now, if not see our Switching Bots with Zwerm guide).
Step 2: Add a payload response
Add a custom payload response:
and then add the following code
{ "#StaMP": true, "from:": "server", "type": "event", "event": "your.event.name", "payload": { "name": "Christina", "email": "$email" } }
(For a description of all different message types, go to https://github.com/zwerm/STaMP)
Step 3: Add a Webhook
Add a Zapier Webhook to your bot. To do this, you will need to complete the ‘Pull in Samples’ step for the ‘Catch Hook’ trigger, and to be able to use the payload data
- In Zapier click “Make a Zap”
- Choose Webhooks
- Choose “Catch hook”
- Click “Pull In Samples”
- Go down to “Test this step”
- Copy the URL
- In Zwerm create your bot
- Select its settings
- Choose “Integrations”
- Post the copied URL into the field titled “Webhook URL”
- Click Add, and then Test
- It should say “ “
- Now go into Zapier, still in “Test this step section”
- Click “Okay I did this”
- Zapier is now waiting for your event and will show one hook with event ‘zwerm.test’
- Open your bot through Zwerm and message it with the trigger phrase (ie: Send an email to name@email.com) to trigger the event
- If this doesn’t work ensure you have your phrases and actions set appropriately in Dialogflow
- Zapier will pick-up the incoming event and will now show multiple hooks
- Select the most recent one (usually Hook A) and check to see if it contains your payload name and email (payload.name, payload.email)
- Click “Continue”
Step 4: Configure the filter
Configure the filter to only listen to your.event.name
Step 5: Add an action
Add a ‘Send Outbound Email’ action into Zapier
- Click new action
- Choose Email
- Choose outbound email
- Select information based on payload
- Once this is done activate your Zap
And then… You’re good to go! Enjoy your emails…