CHARGE: 3 CREDITSTHIS SCRIPT REQUIRES ACCESS TO A CHATBOTSHOP MEMBERSHIP KEY AND CREDITS
Affiliate network Postback Script
In This Chapter You Will Learn How To Use a Callback Script For Affiliates Through The Api
What Do You Need To Set This Up?
- Your ManyChat API key
- The user_id variable
- Your Facebook Page ID
- Your unique TAG and Custom Field IDs
- 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 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 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 the ChatbotShop.net Secret Key?
Please click the link at the bottom of this page to get your secret (license) key.
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 assign as many TAGs or CUFs as you want, we will oop through them all as long as they have the PREFIX set correctly.
This form will help you set up your link
With these form fields you can make a start with your URLRemember the USER_ID should be sent from your affiliate dashboard variable. We don't know those values for you.
Your Possible Callback URL
https://chatbotshop.net/cl-server/mc-api/aff-api.php?
Please note: your custom field MUST already exist BEFORE running this flow or you will get an error.
© ChatbotDojo™ - Become a #botninja Today!