Skip to content

TikTok API

TikTok also have the concept of Ad Account. The OAuth for tiktok is setup from here. The version of API is 1.3. In the link we can see the following image: Tiktok OAuth Dialog Box Tiktok Oauth Dialog Box

The user can provide us permission to the services by selecting the boxes. The user need to provide permission for reporting scope. We need to be able to pull at least user advertiser id and advertiser name in order to pull reports data. If that is not in the response then the backend is configured to error and redirect to failed-connection popup.

The Frontend Flow

The frontend flow is similar to that of Facebook integration. It is shown below:

Tiktok Frontend Flow Tiktok Frontend Flow

View Images

If the images content for frontend flow is not visible, you could open in new tab by right clicking on the image and zoom it.

In the frontend when we create a new connection, if the connection already exists then the flow is redirected to modal, otherwise it is redirected to the popup where we can import connection. In case of failed connection, it is redirected to the failed popup. In import popup as we can see in the above figure we can toggle and save an ad account and those account which already exist, will have lock symbol in enabled column.

From the modal we can also reimport the account by going to the edit accordion by selecting the connection first. The edit accordion is shown below:

Edit Account Accordion

The same reimport popup will appear as explained earlier.

Backend

The integration involves commands and views.

View

Views are located at backend.api.external.tiktok. Typical functionality include initialization of session, handling of callback and fetching of accounts. The code also has documentation link included.

Command

For each ad account the update_tiktok_report.py command pulls the report data and saves to tiktok_basic_report using django ORM. Absent data are returned as - which is also taken care of in the command.