Este documento se ha actualizado.
La traducción en Español (España) no está disponible todavía.
Actualización del documento en inglés: 7 ago. 2023
Actualización del documento en Español (España): 29 mar. 2018

Referencia del evento del webhook messaging_referrals

Esta devolución de llamada se producirá cuando el usuario ya tenga una conversación iniciada con el bot y acceda a dicha conversación en las siguientes situaciones:

Para hacer un seguimiento de las referencias en conversaciones nuevas, consulta evento de postback.

Si deseas comenzar a recibir estos eventos, debes suscribirte a messaging_referrals en la configuración del webhook de tu app.

Índice

Ejemplos

Enlace m.me

{
  "sender": {
    "id": "<PSID>"
  },
  "recipient": {
    "id": "<PAGE_ID>"
  },
  "timestamp": 1458692752478,
  "referral": {
    "ref": <REF_DATA_PASSED_IN_M.ME_PARAM>,
    "source": "SHORTLINK",
    "type": "OPEN_THREAD",
  }
}

Referencia de anuncios

{
  "sender": {
    "id": "<PSID>"
  },
  "recipient": {
    "id": "<PAGE_ID>"
  },
  "timestamp": 1458692752478,
  "referral": {
    "ref": <REF_DATA_IF_SPECIFIED_IN_THE_AD>,
    "ad_id": <ID_OF_THE_AD>,
    "source": "ADS",
    "type": "OPEN_THREAD",
    "ads_context_data": {
      "ad_title": <TITLE_OF_THE_AD>,
      "photo_url": <URL_OF_THE_IMAGE_FROM_AD_THE_USER_IS_INTERESTED_IN>,
      "video_url": <THUMBNAIL_URL_OF_THE_VIDEO_FROM_THE_AD>,
      "post_id": <ID_OF_THE_POST>,
      "product_id": <PRODUCT_ID>
    }
  }
}

Plugin de chat con clientes

Cambio radical (5 de mayo de 2020)

A partir de la versión 7.0 de la API Graph, el evento de webhook messaging_referrals del plugin de chat no devolverá el campo sender.id. Devolverá un nuevo campo sender.user_ref. Estos cambios tendrán efecto en todas las versiones anteriores de la API Graph a partir del 2 de noviembre de 2020.

Nuevo evento de webhook de referencia (versión 7.0 y posteriores de la API Graph, y todas las versiones de la API Graph a partir del 2 de noviembre de 2020)

{
  "sender":{
    "user_ref":"<USER_REF>"
  },
  "recipient":{
    "id":"<PAGE_ID>"
  },
  "timestamp": 1458692752478,
  "referral": {
     "ref": "<REF_DATA_PASSED_IN_CODE>",
     "source": "CUSTOMER_CHAT_PLUGIN",
     "type": "OPEN_THREAD",
     "referer_uri": "<WEBSITE_URL>"
  }
}

Evento anterior de webhook de referencia (versión 6.0 o anterior de la API Graph: disponible hasta el 2 de noviembre de 2020)

{
  "sender":{
    "id":"<PSID>"
  },
  "recipient":{
    "id":"<PAGE_ID>"
  },
  "timestamp": 1458692752478,
  "referral": {
     "ref": "<REF_DATA_PASSED_IN_CODE>",
     "source": "CUSTOMER_CHAT_PLUGIN",
     "type": "OPEN_THREAD",
     "referer_uri": "<WEBSITE_URL>"
  }
}

Propiedades

sender

sender FieldDescription

id

string

The Page-scoped ID for the person who sent a message to your business

user_ref

string

The reference for a person who used the Chat Plugin to messsage your business

recipient

recipient FieldDescription

id

string

The ID for your Facebook Page

referral

PropiedadTipoDescripción

source

Cadena

La fuente de la referencia. Valores admitidos:

  • ADS
  • SHORTLINK
  • CUSTOMER_CHAT_PLUGIN

type

Cadena

El tipo de referencia. Actualmente admite OPEN_THREAD.

ref

Cadena

El atributo ref opcional configurado en la referencia. Solo se admiten caracteres alfanuméricos, además de -, _ y =.

referer_uri

Cadena

El URI del sitio desde donde se envió el mensaje en el plugin de chat de Facebook.

is_guest_user

Cadena

Una marca que indica si el usuario es un invitado del plugin de chat de Facebook.

ads_context_data

Objeto

Los datos que contienen información sobre el anuncio de CTM, desde el cual el usuario inició la conversación.

ads_context_data

PropertyTypeDescription

ad_title

String

Title of the Ad.

photo_url

String

[Optional] Url of the image from the Ad the user is interested.

video_url

String

[Optional] Thumbnail url of the the video from the ad.

post_id

String

ID of the post.

product_id

String

[Optional] Product ID from the Ad the user is interested.