Skip to main content
Best answer

Choose some items from webhook array to send to email


Hi. I want to use Zapier to send an email about orders coming from my food ordering website. I’ve been able to get items (I’m not sure if that’s the right term) from the webhook trigger such us name, email, phone, total price, etc. But I want to also include and list the dishes, quantity, options, etc. I cannot use the same method that I used for the other items because the number of dishes is different everytime. If there’s only one dish ordered then it’s ok. But if there are two or more, I cant list them. Here’s a test order that I made. Hope someone can help me. Thank you!

[
 {
 "secret": "6ac86b31-ecf4-4240-a9e4-2bb1b5cd6cdb",
 "event": "order_new",
 "event_id": "kVbJ2TrJgS73WAwaLJ2eZ",
 "restaurant_id": "RES5riadRPP6wzmHKpbhiUUB",
 "restaurant_name": "Borrowed Kitchen",
 "restaurant_address": "Manila",
 "order_type": "Pickup",
 "data": {
 "order": {
 "_id": "qHRjBh_zNIZ2PKWzbbv1Q",
 "restaurant_id": "RES5riadRPP6wzmHKpbhiUUB",
 "organisation_id": "J2-i0ktB_0T5o9KzIQKR_",
 "created": 1589622657522,
 "status": "unconfirmed",
 "seen": false,
 "number": 102,
 "auto_printed": [],
 "notes": "",
 "bill": {
 "currency": "PHP",
 "total": 1633,
 "total_cents": 163300,
 "cart": 1633,
 "discount": 0,
 "taxes": [],
 "tax_in_prices": false,
 "fees": [],
 "tip": 0
 },
 "payment": {
 "method": "cash",
 "currency": "PHP",
 "total": 1633,
 "total_cents": 163300,
 "status": "pending"
 },
 "customer": {
 "_id": "J2-i0ktB_0T5o9KzIQKR_|kjisq3senPYD8dZ7KBBfk",
 "name": "Test Testing",
 "phone": "09875698210",
 "email": "pambansangulam@gmail.com",
 "ip": "130.105.212.235",
 "country": "PH",
 "region": "00",
 "city": "Makati",
 "lat": "14.554729",
 "lng": "121.024445"
 },
 "promos": [],
 "dishes": [
 {
 "type": "standard",
 "_id": "LGNdIrMgR",
 "menu_id": "h2tK12g3N",
 "category_id": "G_WJUX-4R",
 "name": "Adobo",
 "display_name": "",
 "subtitle": "",
 "price": 173,
 "tags": [],
 "status": null,
 "ingredients": [],
 "option_sets": [
 {
 "_id": "IiSx9Pwn3",
 "name": "Add ons",
 "display_name": "",
 "conditions": {
 "required": false,
 "multi_select": true,
 "quantity_select": true,
 "min_options": "",
 "max_options": "",
 "free_amount": ""
 },
 "options": [
 {
 "_id": "wx6y0VjKQ",
 "name": "Rice",
 "price": "20",
 "quantity": 2
 },
 {
 "_id": "ybilWAu8A",
 "name": "Papaya",
 "price": "10",
 "quantity": 1
 }
 ]
 }
 ],
 "choices": [],
 "price_type": "standard",
 "qty": 1,
 "notes": "No salt"
 },
 {
 "type": "standard",
 "_id": "laHDLAnm4",
 "menu_id": "h2tK12g3N",
 "category_id": "zNw1sDRuH",
 "name": "Soy Chicken",
 "display_name": "",
 "subtitle": "",
 "price": 700,
 "tags": [],
 "status": null,
 "ingredients": [],
 "option_sets": [
 {
 "_id": "5ntk8VPn2",
 "name": "Chicken Size",
 "display_name": "",
 "conditions": {
 "required": true,
 "multi_select": false,
 "quantity_select": false,
 "min_options": "",
 "max_options": 1,
 "free_amount": ""
 },
 "options": [
 {
 "_id": "IFZl7HMCn",
 "name": "Regular",
 "price": "450",
 "quantity": 1,
 "status": null
 }
 ]
 },
 {
 "_id": "IiSx9Pwn3",
 "name": "Add ons",
 "display_name": "",
 "conditions": {
 "required": false,
 "multi_select": true,
 "quantity_select": true,
 "min_options": "",
 "max_options": "",
 "free_amount": ""
 },
 "options": []
 }
 ],
 "choices": [],
 "price_type": "standard",
 "qty": 1,
 "notes": ""
 },
 {
 "type": "standard",
 "_id": "laHDLAnm4",
 "menu_id": "h2tK12g3N",
 "category_id": "zNw1sDRuH",
 "name": "Soy Chicken",
 "display_name": "",
 "subtitle": "",
 "price": 290,
 "tags": [],
 "status": null,
 "ingredients": [],
 "option_sets": [
 {
 "_id": "5ntk8VPn2",
 "name": "Chicken Size",
 "display_name": "",
 "conditions": {
 "required": true,
 "multi_select": false,
 "quantity_select": false,
 "min_options": "",
 "max_options": 1,
 "free_amount": ""
 },
 "options": [
 {
 "_id": "kvhu9uOIX",
 "name": "Half",
 "price": "0",
 "quantity": 1,
 "status": null
 }
 ]
 },
 {
 "_id": "IiSx9Pwn3",
 "name": "Add ons",
 "display_name": "",
 "conditions": {
 "required": false,
 "multi_select": true,
 "quantity_select": true,
 "min_options": "",
 "max_options": "",
 "free_amount": ""
 },
 "options": [
 {
 "_id": "wx6y0VjKQ",
 "name": "Rice",
 "price": "20",
 "quantity": 1
 },
 {
 "_id": "ybilWAu8A",
 "name": "Papaya",
 "price": "10",
 "quantity": 2
 }
 ]
 }
 ],
 "choices": [],
 "price_type": "standard",
 "qty": 1,
 "notes": "Chop"
 },
 {
 "type": "standard",
 "_id": "vX0TqkWMm",
 "menu_id": "h2tK12g3N",
 "category_id": "bV2HKjX-W",
 "name": "Tapa",
 "display_name": "",
 "subtitle": "",
 "price": 470,
 "tags": [],
 "status": null,
 "ingredients": [],
 "option_sets": [
 {
 "_id": "IiSx9Pwn3",
 "name": "Add ons",
 "display_name": "",
 "conditions": {
 "required": false,
 "multi_select": true,
 "quantity_select": true,
 "min_options": "",
 "max_options": "",
 "free_amount": ""
 },
 "options": [
 {
 "_id": "wx6y0VjKQ",
 "name": "Rice",
 "price": "20",
 "quantity": 1
 }
 ]
 }
 ],
 "choices": [],
 "price_type": "standard",
 "qty": 1,
 "notes": "Shred"
 }
 ],
 "config": {
 "service": "pickup",
 "due": "later",
 "date": "2020-05-18",
 "time": "10:30",
 "destination": "",
 "destination_misc": "",
 "lat": -1,
 "lng": -1,
 "distance": -1,
 "driving_time": -1,
 "zone": "",
 "table": "",
 "table_id": "",
 "table_password": "",
 "number_of_people": "",
 "confirmed": true,
 "timestamp": 1589769000000
 },
 "updated": 1589622657522,
 "ready_in": {
 "timestamp": 1589769000000
 },
 "delivery_in": null,
 "rush_eta_increment": null
 },
 "customer": {
 "_id": "J2-i0ktB_0T5o9KzIQKR_|kjisq3senPYD8dZ7KBBfk",
 "manual": false,
 "type": "guest",
 "organisation_id": "J2-i0ktB_0T5o9KzIQKR_",
 "restaurants": [
 "RES5riadRPP6wzmHKpbhiUUB"
 ],
 "created": 1589622657533,
 "verified": false,
 "avatar": "",
 "details": {
 "name": "Test Testing",
 "email": "pambansangulam@gmail.com",
 "phone": "09875698210",
 "gender": null,
 "age_range": ""
 },
 "delivery": {
 "destination": "",
 "destination_misc": "",
 "driving_time": 0,
 "distance": 0,
 "lat": 0,
 "lng": 0,
 "zone": ""
 },
 "age_verification": {
 "images": [],
 "status": null
 },
 "meta": {
 "last_ip": "130.105.212.235",
 "last_order": 1589622657533,
 "last_seen": 1589622657533,
 "ip_country": "PH",
 "ip_region": "00",
 "ip_city": "Makati",
 "ip_lat": "14.554729",
 "ip_lng": "121.024445"
 },
 "stats": {
 "orders": 1,
 "sales": 1633,
 "sessions": 1,
 "promos_count": 0,
 "promos_used": []
 }
 }
 }
 }
]

Best answer by ikbelkirasan

Thanks for the mention, @Danvers!

@nckrvr - Indeed, this can be done with a bit of code. I just need more information on the desired output format.

 

View original
Did this topic help you find an answer to your question?
This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

4 replies

Danvers
Forum|alt.badge.img+12
  • Zapier Staff
  • 3731 replies
  • May 19, 2020

Hi @nckrvr

This is possible, though it will likely be fiddly as you’re working from line items and want to convert them to text in a table. So that we know we’re on the same page, could you take a screenshot showing an example of what the items in the order look like in the Zap?

 

Also, I’m going to cc @ikbelkirasan into this thread as he is great with ideas for code steps 🙂

 

 


ikbelkirasan
Forum|alt.badge.img+12
  • Zapier Expert
  • 555 replies
  • Answer
  • May 19, 2020

Thanks for the mention, @Danvers!

@nckrvr - Indeed, this can be done with a bit of code. I just need more information on the desired output format.

 


Danvers
Forum|alt.badge.img+12
  • Zapier Staff
  • 3731 replies
  • July 6, 2020

Hi @nckrvr! Were you able to find the solution to this? I’d love to hear if you were able to put together a code step 🙂


Liz_Roberts
Forum|alt.badge.img+8
  • Zapier Staff
  • 1366 replies
  • August 3, 2020

Hi @nckrvr !

Checking back in to see if you were able to connect with Ikbel and get this code step up and running!