Postback API for Affiliates
all networks - all fields

Classification Basic
Platform ManyChat

Prerequisite

1. Your ManyChat API key

2. The user_id variable

3. Your Facebook Page ID

4. Your unique TAG and Custom Field IDs

5. A chatbotshop.net secret key


How does it work?

Your affiliate network will most likely give you the option to use a postback option you can use in your own admin programs. You can also use this postback URL to update your ManyChat users, without going into any ManyChat Flow itself. You can update Custom Fields and set TAGs.

The base URL you use for the callback/postback, is: https://chatbotshop.net/cl-server/mc-api/aff-api.php

This URL needs to get populated with some data, you can either use the form fields in your affiliate network for this (these are POST actions), or a full URL with fields and values (these are GET actions). I'll explain here what you need to fill in the get a result.

This script will update as many TAGs and CUFs as you pass along, as long as they start with a fixed prefix. These PREFIXES are:
• "mctag_(0-9)" for your TAG IDs, for example mctag_1, where 1 is the unique number of your first ManyChat TAG. To assign tag ID 345567 to a user, you would do mctag_1=345567, 2 tags would be like mctag_1=345567&mctag_2=445567
• "mccuf_(cuf_number)" for your CUF (Custom User Field), for example mccuf_789654, where 789654 is the number of your Custom User Field, this is the number you see in your flow, like {{cuf_789654}}. To assign CUF ID 444444 to a user, you would do mccuf_444444=boughtshoes, 2 custom fields would be like mccuf_444444=boughtshoes&mccuf_55555=interested_in_bags


How to get my ManyChat API key?

Here's a screenshot of how to get the API Key. Make sure you write it down. You do NOT need the "Bearer" section, the Alphanumeric code is enough (see image).

how to get your manychat api

How to get the userID of your ManyChat user?

This is a variable you should have sent to your affiliate network when sending the user via a POST URL in your flow.

How to get your Facebook Page ID?

This is a variable you should have sent to your affiliate network when sending the user via a POST URL (button) in your flow.

How to get these unique IDs for my TAGs?

Here's a screenshot of how to get the ID you need. Make sure you write them down.

how to get your manychat tag id

How to get these unique IDs for my CUFs?

Here's a screenshot of how to get the ID you need. Make sure you write them down.

how to get your manychat custom field number

How to get the ChatbotShop.net Secret Key?

You can get one here. If you require one you will have access to all scripts that belong to your membership. Starting from $15 (this tier includes this script).

How does a link look?

A sample of a postback URL could be (this is 1 line):



https://chatbotshop.net/cl-server/mc-api/aff-api.php?mc_uid=1236698547&secret_key=6D9F6G4T5R67E89&page_id=4564654646546&mc_api=5667567897765:daafdhdfghdfghdfhdffa5798475a6&mctag_1627262=1627262&mctag_2700679=2700679&mccuf_61199=55.95

Here's what values you must, or need to pass on the script. Red fields are the keys and values that identify you and your user, the black, bold fields are the variables you are going to pass onto ManyChat

https://chatbotshop.net/cl-server/mc-api/aff-api.php?mc_uid={{ID}}&page_id={{PAGE_ID}}&secret_key={{YOUR-SECRET-KEY}}&mc_api={{MCAPIKEY}}&mctag_{{YOUR-TAG-ID}}={{YOUR-TAG-ID}}&mctag_{{YOUR-TAG-ID}}={{YOUR-TAG-ID}}&mccuf_{{YOUR-CUF-ID}}={{YOUR-CUF-VALUE}}


A closer look at the URL and its values:


mc_uid                  = {{ID}}
page_id                 = {{PAGE_ID}}
secret_key              = {{YOUR CHATBOTSHOP SECRET KEY}}
mc_api                  = {{MANYCHAT APIKEY}}
mctag_(0-9)             = {{YOUR MANYCHAT TAG ID}}
mccuf_(CUF_NUMBER)      = {{VALUE OF THE CUSTOM FIELD}}

The fields above translate to these (example)


mc_uid                  = 69876986686986986
page_id                 = 465464674764574764
secret_key              = H4JK36H43LK6H34H6LK
mc_api                  = 6436436346346346:4643H6LKJ4H6KL34H6KL34HLK
mctag_1                 = 89689789
mccuf_869868            = 49.99

You can ssign as many TAGs or CUFs as you want, we will oop through them all as long as they have the PREFIX set correctly.



Here's a start if it is not yet entirely clear to you

With these form fields you can try and make a start.
Remember the USER_ID should be sent from your affiliate dashboard variable. We don't know those values for you.

Secret ManyChat API Key - Click here to get one
Secret Key from Us - Click here to get one
- Click here to find yours - don't forget to replace "N" in mctag_n with a unique number from 0-9. e.g. mctag_1, mctag_2, ....
- Click here to find yours - change N with your number in cuf_{number}
you may copy the TAG and CUF in the URL if you have more than one variable to change/assign

Your Possible Callback URL
https://chatbotshop.net/cl-server/mc-api/aff-api.php?

Desired Outcome

If you did everything according to the instructions above, your affiliate network can now send (transaction)reports straight into your ManyChat user fields.

Each time a call to this script is made, it will go through the ManyChat API and update the user information