How to add the AskSpot chat to a mobile app

You can put the AskSpot chat inside your mobile app with a WebView. All it takes is a small HTML page that loads the AskSpot script, hosted somewhere you control and pointed to from a WebView component. This guide shows the page, the script, and how to detect when the chat closes.

Key takeaways

  • Embed the chat in a WebView – a simple hosted HTML page that loads the AskSpot script.
  • The script URL carries your project ID; add ?open=true to open the chat on load.
  • You can listen for chat_closed to react when the user closes the chat.
  • Swap the example IDs for your own project and assistant IDs from AskSpot.

What this does

A WebView shows a web page inside your native app. By pointing it at a small page that loads the AskSpot chat, your app users get the same assistant your website has – without a native SDK. You host one HTML file and reference it from the WebView.

Before you start

  • Your AskSpot project ID and assistant ID (from AskSpot).
  • Somewhere to host a small HTML file, and a WebView in your app.

Step 1 – Create the HTML page

Make a simple HTML page that loads the AskSpot embed script. Adding ?open=true opens the chat as soon as the page loads – which is usually what you want inside a WebView:

<script crossorigin="*" async src="https://chat.askspot.io/api/v1/integration/<your-project-id>/embed-script?open=true"></script>

Host this page somewhere you control.

Step 2 – Point your WebView at it

In your app, set the WebView’s URL to the page you just hosted. That is enough to show the chat in the app.

Step 3 – (Optional) Detect when the chat closes

If your app needs to react when the user closes the chat – for example to hide the WebView – listen for the chat_closed event:

AskWidget["<your-assistant-id>"].addEventListener("chat_closed", (event) => {
  console.log("chat closed", event);
});

Swap in your own IDs. Replace <your-project-id> in the script URL and <your-assistant-id> in the listener with the IDs from your AskSpot account – they identify your project and the specific assistant.

This mobile setup is part of a custom integration – see that page for the full picture.

Do I need a native SDK?

No. The chat runs in a WebView pointed at a small HTML page that loads the AskSpot script – no native SDK required.

How do I open the chat automatically?

Add ?open=true to the embed-script URL, so the chat opens as soon as the WebView loads the page.

Where do I get the project and assistant IDs?

From your AskSpot account. The project ID goes in the script URL; the assistant ID is used in the chat_closed listener.

LinkedIn

Written by

AskSpot builds AI Chat and Inbox Agents for e-commerce: on-site product advice and 24/7 support across email, chat and marketplaces, in 200+ languages.

Case studies

Real results for e-commerce stores

See how online retailers use AskSpot to automate conversations, reduce support workload and grow sales.

All case studies

Ready to make every conversation sell?

Sign up and set up your Agent with the panel's setup assistant – or book a demo and we'll show you AskSpot on your own catalog.