# Smax.bot

**Step 1:** You create 2 blocks on Smax in which 1 block will include the lucky spinner and 1 block will return customer information from the lucky spinner.

![Lucky Spinner block](https://1376861984-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGv3P8RENVCgPPKAc7U%2F-MMYStGV6-Pn25qGq8X7%2F-MMYWkl_pi-32WoXGfT3%2Fimage.png?alt=media\&token=6ac12db3-2eae-417c-b106-511f4f53d57d)

![Confirm Info block](https://1376861984-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGv3P8RENVCgPPKAc7U%2F-MMYStGV6-Pn25qGq8X7%2F-MMYXJuly8HknM29DRhb%2Fimage.png?alt=media\&token=1aa5e8d9-d112-4dd1-b8ef-3f013089f97a)

**Step 2**: On botplus.io you access to the **Push data** menu then select "**Create New Platform**" and select **SmaxBot** in the drop-down menu..

![](https://1376861984-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGv3P8RENVCgPPKAc7U%2F-MMYIPJqe_UbHrtLaGv2%2F-MMYRZeuBZvPDKoJc1Yd%2Fimage.png?alt=media\&token=8784741a-3e45-4d82-b0a1-b6409c9fdceb)

**Step 3:** Connection config

> **Name**: Name of the connection setting
>
> **BotID**: BotID get from Smax.bot
>
> **Bot Token**: Bot Token get from Smax.bat
>
> **Block ID**: ID of the block will return customer information after they play lucky spinner.
>
> **Data Fields**: Data fields to push back from the bot

*To fill in the **Bot ID**, **Bot Token**, **Block ID** information fields, please see the next step.*

![](https://1376861984-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGv3P8RENVCgPPKAc7U%2F-MMYIPJqe_UbHrtLaGv2%2F-MMYRag230GUuh1YgZzD%2Fimage.png?alt=media\&token=c80a58e9-9768-43dd-834d-08089f9b96a3)

**Step 4:**&#x20;

To copy Block ID you copy the number as shown in Pic 1 (after the ?Id =)&#x20;

Then you turn off Block VQMM and click on number 2 to copy Bot ID, number 3 to copy Bot Token&#x20;

After finish you go back to step 3 to fill in the configuration form

![](https://1376861984-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGv3P8RENVCgPPKAc7U%2F-MMYStGV6-Pn25qGq8X7%2F-MMYbT810kS7Xe7ZiVsY%2Fimage.png?alt=media\&token=c9df0600-0f18-4ccd-86eb-c5e6ed2eaa3d)

**Step 5:** Configure data transmission on botplus.io

In the configuration table in the Push Data section, select Add Field to add the data fields sent to SmaxBot

![](https://1376861984-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGv3P8RENVCgPPKAc7U%2F-MMYIPJqe_UbHrtLaGv2%2F-MMYRdm_5jHVD3sNIFGK%2Fimage.png?alt=media\&token=fff80545-253d-4ff5-b643-0ae47d15781a)

Select the Control Name section and you will see the data fields that are created during the process of building the form. And the default fields for example: Gift\_id, Gift\_name, ....

![](https://1376861984-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGv3P8RENVCgPPKAc7U%2F-MMYIPJqe_UbHrtLaGv2%2F-MMYRiCFZOI0inkGw239%2Fimage.png?alt=media\&token=b35849f0-af19-47b3-b45e-41041b202958)

The Control Name column is the column of the variable name you obtained in the form, and the Attr Name column is the column of the attribute name you want to sent to the bot.

![](https://1376861984-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGv3P8RENVCgPPKAc7U%2F-MMYStGV6-Pn25qGq8X7%2F-MMYdOe9dqymgPQrPHJw%2Fimage.png?alt=media\&token=78a20076-f93a-4f11-801f-6a251957f189)

**Step 6:** Declare information for **ConfirmInfo block**

Enter the Attribute Name you entered in step 5 in the confirm Data field

![](https://1376861984-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGv3P8RENVCgPPKAc7U%2F-MMYStGV6-Pn25qGq8X7%2F-MMYdwvn4YOma1P8aaCk%2Fimage.png?alt=media\&token=7f4fbc86-82b4-4702-9d94-6337cc4a5ad2)

**Step 7:** Lucky Spinner Url's config

Go to Menu **URL Address** (1) and select **User free domain**&#x20;

***Note:***&#x20;

* You can edit the items in the free domain to nicer. Eg: **botiosmax.botplus.asia/luckyspinner**
* Bạn có thể sử dụng Use own domain để sử dụng domain riêng của bạn VD **vqmmtest.vn**

**Click Update, then click on item 3 to copy the link for Smaxbot** (the link in the URL above is used when you want to run the web without embedding it in the chatbot).

![](https://1376861984-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGv3P8RENVCgPPKAc7U%2F-MMYIPJqe_UbHrtLaGv2%2F-MMYRnI4uCvs0x0l8Ou1%2Fimage.png?alt=media\&token=531f7f14-8f9c-4934-a867-c4a8c7ad67b0)

**Step 8:** Add turns to spin

![](https://1376861984-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGv3P8RENVCgPPKAc7U%2F-MMYStGV6-Pn25qGq8X7%2F-MMYgNVBZYIUyvxgG-M9%2Fimage.png?alt=media\&token=ada54023-57db-49d3-8c8b-ee4a6047001d)

> 1\. At Lucky Spinner block you choose **Json API** then choose POST protocol
>
> 2\. Copy the url from Step 7 and don't forget to add secret to the url
>
> 3\. Next choose Body. From here you can choose Json or Params
>
> * If you choose Json then you can insert the code as below. Which "turnNumber" is the turn of the lucky spinner.
> * If you choose Params, you add turnNumber to the name and add the number of spins to the value.

![](https://1376861984-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGv3P8RENVCgPPKAc7U%2F-MMYIPJqe_UbHrtLaGv2%2F-MMYRtQBkQQJPN_i4_Gc%2Fimage.png?alt=media\&token=6865298b-6d51-4a89-b5eb-446cd4961ce4)

**Step 9:** Link lucky spinner to button.

In the text in the Lucky Spinner block you select **Add new button** (you can use the Gallerry tag or the Media tab)

![](https://1376861984-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGv3P8RENVCgPPKAc7U%2F-MMYStGV6-Pn25qGq8X7%2F-MMYi82nbTPpsrSAh93L%2Fimage.png?alt=media\&token=57e9d2a3-2dc4-4434-a1f9-b20e2e9b62cc)

You enter the name of the button (eg: Spin) then select the **URL** tab and paste the copy url in **step 7**.

Click outside, you will see a line that is ***Add*** [***https://botiosmax.botplus.asia***](https://botiosmax.botplus.asia) into ..... You click on, the purpose to add domain to the list so that webview can turn on the popup form at messenger.

![](https://1376861984-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGv3P8RENVCgPPKAc7U%2F-MMYStGV6-Pn25qGq8X7%2F-MMYiy3G8Gl0cjg7ykwx%2Fimage.png?alt=media\&token=3def5c09-022e-4199-94ee-4505f4ca47a2)

**Step 10:** Testing

Create a ref link to test if the bot works OK (see how to create a reflink [here](https://bot.vn/hoc-chatbot/tips-chatbot/huong-dan-tao-reflink-cho-block-32.html))

![](https://1376861984-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGv3P8RENVCgPPKAc7U%2F-MMYStGV6-Pn25qGq8X7%2F-MMYjSGgmJcbI70QYRnO%2Fimage.png?alt=media\&token=027b8cc4-89d4-42d6-acd0-8e89946514d6)

Messenger will display a message and a button to open the botgame

![](https://1376861984-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGv3P8RENVCgPPKAc7U%2F-MMYStGV6-Pn25qGq8X7%2F-MMYjdq4OBuD0347WKWh%2Fimage.png?alt=media\&token=d6291033-cf91-48e9-852b-c772241c02c5)

You open the plug-in and test the spin to see your luck

![](https://1376861984-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGv3P8RENVCgPPKAc7U%2F-MMYIPJqe_UbHrtLaGv2%2F-MMYS73wDy6ubtNE2kO8%2Fimage.png?alt=media\&token=e0fa485a-5b4f-4b98-81d9-713f46dab11d)

Next, you fill out the information in the customer information section

![](https://1376861984-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGv3P8RENVCgPPKAc7U%2F-MMYStGV6-Pn25qGq8X7%2F-MMYkU1wCNxY9JTCEOv2%2Fimage.png?alt=media\&token=c5bcfd15-f750-4fbe-b935-4fa0e72682a1)

Submit your information then bot will announce your gift, your remaining spin, and your information.

![](https://1376861984-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGv3P8RENVCgPPKAc7U%2F-MMYStGV6-Pn25qGq8X7%2F-MMYlHF9_lwKOU96CVgv%2Fimage.png?alt=media\&token=baf110b0-8a6b-4110-b39e-b85038f0748e)
