Using Webhooks with Zwerm: a step by step guide

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

  1. In Zapier click ‘Make a Zap’
  2. Choose Webhooks
  3. Choose ‘Catch hook’
  4. Click ‘Pull In Samples’
  5. Go down to ‘Test this step’
  6. Copy the URL
  7. In Zwerm create your bot
  8. Select its settings
  9. Choose ‘Integrations’
  10. Post the copied URL into the field titled ‘Webhook URL’
  11. Click Add, and then Test
  12. It should say ‘ 
  13. Now go into Zapier, still in ‘Test this step section’
  14. Click “Okay I did this”
  15. Zapier is now waiting for your event and will show one hook with event ‘zwerm.test’
  16. Open your bot through Zwerm and message it with the trigger phrase (ie: Send an email to name@email.com) to trigger the event
  17. If this doesn’t work ensure you have your phrases and actions set appropriately in Dialogflow
  18. Zapier will pick-up the incoming event and will now show multiple hooks
  19. Select the most recent one (usually Hook A) and check to see if it contains your payload name and email (payload.name, payload.email)
  20. 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

  1. Click new action
  2. Choose Email
  3. Choose outbound email
  4. Select information based on payload
  5. Once this is done activate your Zap

And then… You’re good to go! Enjoy your emails…