Chatbot
How integrate your chatbot
Prerequisite
Before integrating the YourCall Chatbot on your website, you will need the following:
-
Client ID (
clientId
)This is a unique identifier provided by YourCall to identify your account.
-
Agent ID (
agentId
)This is the identifier of the agent
You can retrieve your Client ID and Agent ID from your YourCall dashboard or by contacting your account manager.
Embedding of the chatbot
To embed the chatbot, add an <iframe>
to your page with the following URL:
URL parameters
- agentId: your Agent ID
- clientId: your Client ID
- locale: (Optional fallbacks to fr) available locales: fr, en, de, es, it, nl
Programmatic interaction (Optional)
To interact with the chatbot from your website you will need to add to the end of your <body>
of your html
Initializing the Chatbot API
Once the library is loaded, you can create an instance of YourCallChatbot
:
Alternatively, you can pass a direct reference to the iframe:
Available methods
sendMessage(message: string): void
Sends a message to the chatbot as if the user typed it.
sendMetadata(metadata: Record<string, unknown>): void
Sends additional metadata related to the customer, session, or any relevant context.
You can use this to pass information such as the user's plan, user ID, or any business-specific data.
setCustomerId(customerId: string): void
⚠️ Deprecated
Previously used to associate a customer ID to the chat session.
You should now use sendMetadata()
instead.
setHeadline(headline: string): void
Sets or updates the chatbot’s headline message (the welcome message displayed at the top of the chat).
Important:
The headline can only be set before the user has sent any message.
Once the conversation has started, updating the headline will have no effect.
setQuickReplies(quickReplies: string[]): void
Displays a list of quick reply buttons in the chat interface.
These buttons can help users reply faster by clicking instead of typing.
Setting them when quick replies are present will replace the previous.
toggleLogs(): void
Enables or disables debug logs in the browser console.
Useful during integration or troubleshooting.
reset(): void
Reset the current chat session.
Interacting with the Chat from your Tool responses
Actions are special commands triggered by tools during a chat session that enhance the chatbot's capabilities by embedding interactive UI components into the conversation.
To implement these actions and UI elements, wrap your action data within a yourcall_actions
object, which serves as the top-level container for all action integrations.
Example
Button action
The button action adds a clickable link to the chatbot that directs users to a specific URL. You must provide both a link and a text field.
The text field automatically translates to the user's current chat session language.
Quick replies action
Quick replies can be specified in your tool response. The system will automatically translate each reply to the user's chat session language if needed.