Solicitud de Webhook de Cumplimiento

Si está creando un agente de Dialogflow que usa Dialogflow Fulfillment ampliamente, encontrará que los datos pasados por el proveedor del canal son útiles para su aplicación. Estos datos se pasan de la plataforma Telenet a Dialogflow mediante el campo originalDetectIntentRequest.

Objeto de Contacto

Para permitir casos de uso más avanzados de la API, la plataforma agrega el objeto de contacto a la solicitud. El elemento cId en el objeto de contacto refleja el mismo valor utilizado en la API de contactos.

  "contact": {
        "cId": "60133386712",
        "contactId": 123456,
        "channelId": 7890
    }

Facebook

"originalDetectIntentRequest": {
    "payload": {
      "source": "facebook",
      "contact": {
        "cId": "3854977680200098",
        "contactId": "123456",
        "channelId": "7890"
      },
      "attachments": [
        {
          "type": "location",
          "payload": {
            "lat": 3.146642,
            "long": 101.695847,
            "address": "Kuala Lumpur City Center"
          }
        }
      ],
      "body": {
        "entry": [
          {
            "messaging": [
              {
                "recipient": {
                  "id": "177689475607202"
                },
                "message": {
                  "text": "hi",
                  "mid": "D3DJuA0YlOgDgOybFG1M2ZHoJg9hq9IAjMQE2ps6RIN4QJ25rNPMi"
                },
                "timestamp": 1564743055901,
                "sender": {
                  "id": "2254108171328398"
                }
              }
            ],
            "id": "177689475607202",
            "time": 1564743056313
          }
        ],
        "object": "page"
      }
    }
  }

LINE

"originalDetectIntentRequest": {
  "payload": {
    "source": "line",
    "contact": {
        "cId": "U905251b5f5759acde5e4788681c04269",
        "contactId": 123456,
        "channelId": 7890
    },
    "attachments": [
        {
          "type": "location",
          "payload": {
            "lat": 3.146642,
            "long": 101.695847,
            "address": "Kuala Lumpur City Center"
          }
        }
      ],
    "body": {
      "events": [
        {
          "type": "message",
          "replyToken": "16a59224c65b4c5cbecedc4f3504599b",
          "source": {
            "userId": "U905251b5f5759bbde5e4788681c04170",
            "type": "user"
          },
          "timestamp": 1593146060317,
          "mode": "active",
          "message": {
            "type": "text",
            "id": "12211455206333",
            "text": "Hi"
          }
        }
      ],
      "destination": "U5698920083824716136c04633a9e1710"
    }
  }
}

SMS

"originalDetectIntentRequest": {
  "payload": {
    "source": "twilio",
    "contact": {
        "cId": "+12262120005",
        "contactId": 123456,
        "channelId": 7890
    },
    "attachments": [
        {
          "type": "location",
          "payload": {
            "lat": 3.146642,
            "long": 101.695847,
            "address": "Kuala Lumpur City Center"
          }
        }
      ],
    "body": {
      "ToCountry": "CA",
      "ToState": "Ontario",
      "SmsMessageSid": "SM1f1c9a30ff67cf5b1a89d5b1e0735a2b",
      "NumMedia": "0",
      "ToCity": "",
      "FromZip": "",
      "SmsSid": "SM1f1c9a30ff67cf5b1a89d5b1e0735a2b",
      "FromState": "Ontario",
      "SmsStatus": "received",
      "FromCity": "St Thomas",
      "Body": "Hi",
      "FromCountry": "CA",
      "To": "+12267022870",
      "ToZip": "",
      "NumSegments": "1",
      "MessageSid": "SM1f1c9a30ff67cf5b1a89d5b1e0735a2b",
      "AccountSid": "AC75bcf6cd15a35c46c6e5fa6d6dde6028",
      "From": "+12262121015",
      "ApiVersion": "2010-04-01"
    }
  }
}

Telegram

"originalDetectIntentRequest": {
  "payload": {
    "source": "telegram",
    "contact": {
        "cId": "928825753",
        "contactId": 123456,
        "channelId": 7890
    },
    "attachments": [
        {
          "type": "location",
          "payload": {
            "lat": 3.146642,
            "long": 101.695847,
            "address": "Kuala Lumpur City Center"
          }
        }
      ],
    "body": {
      "update_id": 68062810,
      "message": {
        "message_id": 358,
        "from": {
          "id": 921815852,
          "is_bot": false,
          "first_name": "Leo",
          "language_code": "en"
        },
        "chat": {
          "id": 921815852,
          "first_name": "Leo",
          "type": "private"
        },
        "date": 1593415824,
        "text": "Hi"
      }
    }
  }
}

Twitter

"originalDetectIntentRequest": {
  "payload": {
    "source": "twitter",
    "contact": {
        "cId": "800244779787258095",
        "contactId": 123456,
        "channelId": 7890
    },
    "body": {
      "for_user_id": "800244779786258096",
      "direct_message_events": [
        {
          "type": "message_create",
          "id": "1277881813680091140",
          "created_timestamp": "1593505740934",
          "message_create": {
            "target": {
              "recipient_id": "800244779786258096"
            },
            "sender_id": "1236829623670812661",
            "message_data": {
              "text": "Hi",
              "entities": {
                "hashtags": [],
                "symbols": [],
                "user_mentions": [],
                "urls": []
              }
            }
          }
        }
      ],
      "users": {
        "1236829623670812661": {
          "id": "1236829623670812661",
          "created_timestamp": "1583718145786",
          "name": "leoawesome",
          "screen_name": "leoawesome21",
          "protected": false,
          "verified": false,
          "followers_count": 0,
          "friends_count": 1,
          "statuses_count": 0,
          "profile_image_url": "http://abs.twimg.com/sticky/default_profile_images/default_profile_normal.png",
          "profile_image_url_https": "https://abs.twimg.com/sticky/default_profile_images/default_profile_normal.png"
        },
        "800244779786258096": {
          "id": "800244779786258096",
          "created_timestamp": "1479628198125",
          "name": "telenet",
          "screen_name": "telenet_",
          "description": "https://t.co/8AN2CVzhwJ is a business messaging platform that connects customers from any channel to every team.",
          "url": "https://t.co/vE593YRZwo",
          "protected": false,
          "verified": false,
          "followers_count": 246,
          "friends_count": 23,
          "statuses_count": 1527,
          "profile_image_url": "http://pbs.twimg.com/profile_images/1250330944067653632/3KiCeUhc_normal.jpg",
          "profile_image_url_https": "https://pbs.twimg.com/profile_images/1250330944067653632/3KiCeUhc_normal.jpg"
        }
      }
    }
  }
}

Viber

"originalDetectIntentRequest": {
  "payload": {
    "source": "viber",
    "contact": {
        "cId": "T1yTBK3PQTHAFchsDh1skA==",
        "contactId": 123456,
        "channelId": 7890
    },
    "attachments": [
        {
          "type": "location",
          "payload": {
            "lat": 3.146642,
            "long": 101.695847,
            "address": "Kuala Lumpur City Center"
          }
        }
      ],
    "body": {
      "event": "message",
      "timestamp": 1593420787910,
      "chat_hostname": "BN-CHAT-14_",
      "message_token": 5458312086267550000,
      "sender": {
        "id": "T1yTBK3PQFGAGdhsDh1skA==",
        "name": "Leo",
        "avatar": "https://media-direct.cdn.viber.com/download_photo?dlid=tHBOJafTJ8WSwoFLCQ0x1lmS8RXeDXXyUVoAoLmmOGPIMprwqNCUO6BH3cG-VoAYd3WetLrBK4nP7C86ZN3MxG5T40A1lduzChAts-ULz0oO9l7FjW3bAYljiLyTGkYbaCRjcQ&fltp=jpg&imsz=0000",
        "language": "en",
        "country": "MY",
        "api_version": 8
      },
      "message": {
        "text": "Hi",
        "type": "text"
      },
      "silent": false
    }
  }
}

WeChat

"originalDetectIntentRequest": {
  "payload": {
    "source": "wechat",
    "contact": {
        "cId": "ovYOJv8eZlJ5efKToATGeOk5hBQM",
        "contactId": 123456,
        "channelId": 7890
    },
    "attachments": [
        {
          "type": "location",
          "payload": {
            "lat": 3.146642,
            "long": 101.695847,
            "address": "Kuala Lumpur City Center"
          }
        }
      ],
    "body": {
      "xml": {
        "ToUserName": [
          "gh_5b17802cd972"
        ],
        "FromUserName": [
          "ovYOJv8eZlJ5evMToATGePk5hAQM"
        ],
        "CreateTime": [
          "1593421765"
        ],
        "MsgType": [
          "text"
        ],
        "Content": [
          "Hi"
        ],
        "MsgId": [
          "22812312807562437"
        ]
      }
    }
  }
}

Webchat

"originalDetectIntentRequest": {
  "payload": {
    "source": "webchat",
    "contact": {
        "cId": "e6507476-e507-4503-9652-bcde24e8ea88",
        "contactId": 123456,
        "channelId": 7890
    },
    "body": {
      "sender": {
        "id": "07f1e397-12a8-485b-a417-14d7e3837608",
        "locale": "en_US"
      },
      "recipient": {
        "id": "4db00a5db70efbb51a0cd6a6635918390dd1945a89ce77898ab66b82d5c15344"
      },
      "query": [
        {
          "type": "query",
          "text": "Hi"
        }
      ]
    }
  }
}

WhatsApp

"originalDetectIntentRequest": {
  "payload": {
    "source": "twilio_whatsapp",
    "contact": {
        "cId": "whatsapp:+60133385703",
        "contactId": 123456,
        "channelId": 7890
    },
    "attachments": [
        {
          "type": "location",
          "payload": {
            "lat": 3.146642,
            "long": 101.695847,
            "address": "Kuala Lumpur City Center"
          }
        }
      ],
    "body": {
      "SmsMessageSid": "SMb16231017683857d42ca62aafabcf205",
      "NumMedia": "0",
      "SmsSid": "SMb16231017683857d42ca62aafabcf205",
      "SmsStatus": "received",
      "Body": "Hi",
      "To": "whatsapp:+14155238886",
      "NumSegments": "1",
      "MessageSid": "SMb16231017683857d42ca62aafabcf205",
      "AccountSid": "AC75bcf6cd15a35c46c6e5fa6d6dde6028",
      "From": "whatsapp:+60144486813",
      "ApiVersion": "2010-04-01"
    }
  }
}

Last updated