<commit_before>.. _web_hooks/post_share:
.. include:: /partials/common.rst

Post Share Web Hook
===================

Triggered when a |advocate| person shares offer details with referred persons via
corresponding form provided by campaign workflow.

.. raw:: html

   <h2>Payload parameters provided for Post Share Web Hook</h2>

* **campaign** — subhash of parameters describing the campaign

  * **id** — unique campaign ID
  * **cached_slug** — unique SEO friendly ID
  * **type** — either *"StandaloneCampaign"* or *"DoubleSidedDealCampaign"*
  * **tag_names** — array of campaign’s tags

* **share_type** — *"email"*, *"facebook"*, or *"twitter"*
* **share_info** — share-specific information

  * For Facebook share:

    * **facebook_share_post_id** — Facebook post ID
    * **facebook_share_user_id** — Facebook user ID

  * For email share:

    * **recipients** — array of email addresses

* **share_link** — link sent in share message (optional, present only for Facebook and Twitter shares)
* **origin** — contains data about the event that issued an offer:

  * **type**

    * *"Purchase"* for post-purchase campaign
    * *"AffiliateMember"* for standalone campaign

  * **id** — unique identifier of the origin event
  * **email** — e-mail address of the referrer person

.. raw:: html

   <h2>Sample payload</h2>

.. code-block:: javascript

   {
     "campaign": {
       "id": 556735918,
       "type": "StandaloneCampaign",
       "cached_slug": "affiliate-campaign-test",
       "tag_names": ["default"]
     },
     "share_type": "email",
     "share_info": {
       "recipients": ["<EMAIL>"]
     },
     "origin": {
       "id": 199948681,
       "email": "<EMAIL>",
       "type": "Purchase"
     }
   }

.. raw:: html

   <h2>cURL example</h2>

.. code-block:: bash

   curl --data 'key=<key>&payload={"campaign":{"id":556735918,"type":"StandaloneCampaign","cached_slug":"affiliate-campaign-test","tag_names":["default"]},"share_type":"email","share_info":{"recipients":["<EMAIL>"]},"origin":{"id":199948681,"email":"<EMAIL>","type":"Purchase"}}' <url>

.. container:: hidden

   .. toctree::<commit_msg>re-wrote the post share webhook doc<commit_after>.. _web_hooks/post_share:
.. include:: /partials/common.rst

Post Share Webhook
===================

Talkable Post Share Webhook provides notification of a share event performed within a referral campaign workflow. Use cases for the Post Share Webhook include:

  * Sending automated 'Thank You' email to an Advocate for performing a share
  * Any event that should be triggered when a user shares 

.. raw:: html

   <h2>When does Talkable call the Post Share Webhook?</h2>

Talkable Post Share Webhook is triggered any time an Advocate (referrer) shares offer details with a Friend (referee) via the corresponding form provided by campaign workflow.  Which includes any time: 

  * An advocate shares with a Friend via Email or any other channel from inside a referral campaign workflow
  * An Advocate copies a share link from a referral campaign workflow share screen

Note: the Post Share Webhook triggers every time a share occurs. For example, if an Advocate shares with a Friend via email (or any channel), then shares with a second Friend via email (or any channel), the Post Share Webhook will be triggered twice. 

.. raw:: html

   <h2>Payload parameters provided for Post Share Webhook</h2>

* **campaign** — subhash of parameters describing the campaign

  * **id** — unique campaign ID
  * **cached_slug** — unique SEO friendly ID
  * **type** — either *"StandaloneCampaign"* or *"DoubleSidedDealCampaign"*
  * **tag_names** — an array of campaign’s tags
  * **origin_min_age** — timeframe from first site visit when an offer is available to Advocate
  * **origin_max_age** — timeframe from first site visit when an offer is available to Advocate
  * **new_customer** — “yes/no” whether offer requires Advocate to be a new customer

* **share_type** — *"email"*, *"facebook"*, *"twitter"*, *"facebook_message"*, *"facebook_sponsored"*, *"whatsapp"*, *"sms"*, *"linkedin"*, *"other"*

  * Note: custom share_type's can be created

* **share_info** — share-specific information

  * For Facebook share:

    * **facebook_share_post_id** — Facebook post ID
    * **facebook_share_user_id** — Facebook user ID

  * For email share:

    * **recipients** — an array of email addresses

* **share_link** — link sent in share message (optional, present only for Facebook and Twitter shares)
* **origin** — contains data about the event that issued an offer:

  * **type**

    * *"Purchase"* for post-purchase campaign
    * *"AffiliateMember"* for standalone campaign
    * *"Event"* for event type origin (such as a signup page which triggers a referral campaign)

  * **id** — unique identifier of the origin event
  * **email** — e-mail address of the Advocate (referrer)

.. raw:: html

   <h2>Sample payload</h2>

.. code-block:: javascript

   {
     "campaign": {
       "id": 83587635,
       "type": "StandaloneCampaign",
       "cached_slug": 83587635,
       "tag_names": ["default"],
       "origin_min_age": null,
       "origin_max_age": null,
       "new_customer": null
     },
     "share_type": "email",
     "share_info": {
       "recipients": ["<EMAIL>"]
     },
     "origin": {
       "id": 273085748,
       "type": "Purchase",
       "email": "<EMAIL>"
     }
   }


.. raw:: html

   <h2>cURL example</h2>

.. code-block:: bash

   curl --data 'key=<key>&payload={"campaign": {"id": 83587635, "type": "StandaloneCampaign", "cached_slug": 83587635, "tag_names": ["default"], "origin_min_age": null, "origin_max_age": null, "new_customer": null }, "share_type": "email", "share_info": {"recipients": ["<EMAIL>"] }, "origin": {"id": 273085748, "type": "Purchase", "email": "<EMAIL>"} }' <url>

.. container:: hidden

   .. toctree::
{'fraction_non_alphanumeric': 0.1480403902105083, 'fraction_numerical': 0.017114495978093443, 'mean_word_length': 3.890376569037657, 'pattern_counts': {'":': 54, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6792149', 'n_tokens_mistral': 1868, 'n_tokens_neox': 1743, 'n_words': 625}