App Messages
Embedding app messages are send from the host website
AppMessage
App messages can be send to an embedded Packhunt solution. They are using the Window.postMessage()
function from a parent context.
LoadAppMessage
The loadAppMessage
must be send before any other app message to connect your website
Name |
Type |
Required |
Description |
messageType |
"loadApp" |
Yes |
A constant loadAppMessage |
messageData |
LoadAppMessageData |
Yes |
The options to pass to the message |
LoadAppMessageData
Name |
Type |
Required |
Description |
auth |
AppAuth |
Yes |
Authentication parameters to pass to the app |
navigate |
AppNavigate |
Yes |
Navigation parameters to pass to the app |
AppAuth
Name |
Type |
Required |
Description |
type |
"apiKey" |
Yes |
The authentication type to apply, currently only apiKey is supported |
value |
string |
Yes |
The authentication token value. |
AppNavigate
The navigation of the app, these parameters are used after the app successfully authenticated the user
Name |
Type |
Required |
Description |
project |
string |
Yes |
The project slug to navigate to, this value matches the solution name. |
flow |
string |
No |
The flow slug to navigate to. To navigate to a solution page this value can be left empty. |
AppUserMessage
This message can be send to communicate to the Packhunt app, only messages found in allowedMessages
of the embedLoadedEvent
eventData
are allowed. Note that when sending user messages the messagePayload must validate against its allowed message schema
Name |
Type |
Required |
Description |
messageType |
"userMessage" |
Yes |
A constant appUserMessage |
messageData |
AppUserMessageData |
Yes |
The message data |
AppUserMessageData
Name |
Type |
Required |
Description |
name |
string |
Yes |
Corresponds to the name in the embedLoadedEvent eventData . This tells the app which embed to target within the app. |
messageId |
string |
Yes |
The id of the message. This must correspond to one of the allowedMessages defined in the embedLoadedEvent eventData . |
messagePayload |
any |
Yes |
The payload to send. The payload must match its corresponding schema in the allowedMessages in the embedLoadedEvent eventData |