Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Campaign Webhook

Table of Contents

Scope

The Publisher API Webhook campaign webhook allows the V2 API to be used without having to use a OAuth token so you can use Webhooks to send data into Convertr. This is done by providing a unique campaign level token which is active for the duration of the campaign. This allows the user to post to the campaign with an optional publisherId without having to renew their access tokenuser to post data to a Convertr campaign using a campaign API key to authenticate the request.
This endpoint also allows for cross-origin requests allowing client-side applications to POST data to Convertr.

Setup Process

...

  1. Go to ‘Setup’ under the ‘Admin’ tab on the Convertr campaign overview dashboard

...

    ...

    1. Once you

    ...

    1. are on the setup page, scroll down to the ‘Campaign API’ section. This is where you will see the ‘Campaign API Key’. This will present a code that will function as the access token for the duration of the campaign you have selected.

    ...

    Using the Campaign API Key

    Form Fields Endpoint

    This API call will supply an array of forms , which are available to `POST` leads to (see section 3.5) on a given campaign. The response will allow you to see which form fields are available to populate per form (each campaign can have multiple forms)along with the form fields on the campaign.

    Example Form Fields Request

    ...

    ...

    GET request - Campaign Form Fields
    Code Block
    languagejs
    https://[{enterprise]}.cvtr.io/webhook/campaign/[CampaignID]/{campaign_id}/global-form/fields?apikey=[campaignAPIkey]

    Example Form Fields Response

    Code Block
    title
    {campaign_api_key}

    Example Form Fields Response

    GET response - Campaign Form Fields
    Code Block
    [
        {
            "formName": "Form Fields Endpoint",
            "formId": 75,
            "fields": [
                "form[firstName]",
                "form[lastName]",
                "form[email]",
                "form[telephone]"
            ]
        }
    ]

    Campaign Links Endpoint

    This API method call will return an array of available links for the given campaign. Links are required as it provides The Link ID is optional but it does provide insight into which channel a lead entered the Convertr Platform or was captured.

    Example Campaign Links Request

    Code Block
    languagejstitleGET request - Campaign Links
    https://[{enterprise]}.cvtr.io/webhook/campaign/[CampaignID]{campaign_id}/links?apikey=[campaignAPIkey]{campaign_api_key}

    Example Campaign Links Response

    ...

    Code Block
    [
        {
            "id": 135,
            "name": "Campaign Links Endpoint",
            "channel": "Email",
            "destination": "https://Campaign-Links-Endpoint.cvtr.io/lp/Campaign-Links-Endpoint"
        }
    ]

    Campaign Lead Post Endpoint

    The API campaign key method call will allow you to post leads to the given campaign.

    Example Lead Post Request

    POST request - Lead Data
    Code Block
    languagejs
    titlePOST request - Lead Data
    https://[{enterprise]}.cvtr.io/webhook/campaign/{campaign/[CampaignID]/links?apikey=[campaignAPIkey]&campaignLinkId=[linkid]_id}/global-form/{global_form_id}/leads?apikey={campaign_api_key}&campaignLinkId={link_id}

    Example Lead Post Request with Publisher ID

    Additionally if Additionally if you want would like to pass the publisher id with the lead you can post as below (the publisher ID can be obtained from the platform by going to the publisher section section - https://[enterprise].cvtr.io/publisher/list).

    POST request - Lead Data & Pub ID
    Code Block
    title
    languagejsPOST request - Lead Data
    https://[{enterprise]}.cvtr.io/webhook/campaign/[CampaignID]/links?apikey=[campaignAPIkey]&campaignLinkId=[linkid]&publisherId=[publisherId]{campaign_id}/global-form/{global_form_id}/leads?apikey={campaign_api_key}&campaignLinkId={link_id}&publisherId={publisher_id}

    Example Lead Post Payload (unencoded)

    POST request - Lead Data Payload
    Code Block
    languagejstitleGET request - Campaign Links
    form[firstName]=Joe&form[lastName]=Bloggs&form[email]=tech@convertrmediatech@convertr.netio&form[telephone]=02036177659

    Example Lead Post Response

    ...

    POST response -

    ...

    Lead Data
    Code Block
    {
        "code": 201,
        "message": "Lead was created successfully",
        "data": 55907
    }

    Error Responses

    Error code

    Error Body

    Description

    1

    500

    {"code": 500, "message": ""}

    Internal server error.

    2

    404

    The server returned a "404 Not Found"

    Campaign ID incorrect, incorrect URL or Global Form ID does not exist

    3

    404

    {"code": 404,"message": "Publisher not found"}

    Publisher ID incorrect

    4

    400

    {"code": 400,"message": "Validation failed","data": [{"message": "This form should not contain extra fields."},{"fieldName": "form[field name]","message": ""}]}

    The form field(s) submitted is/are incorrect and do not match the correct form mapping

    5

    400

    {"code": 400,"message": "Validation failed","data": [{"message": "This form should not contain extra fields."}]}

    Some form field(s) submitted in your request do not exist on the form

    6

    401

    {"code": 401,"message": "Access denied."}

    Access denied. Incorrect API key 

    7

    403

    {"code": "403","error": "Campaign is inactive"}

    Campaign is inactive