Messenger error 2018163: Begin Share Param Validation Error
Last verified against Meta for Developers - Messenger Platform error codes
Begin Share Param Validation ErrorWhat error 2018163 means
Code 2018163 is returned by the Messenger Extensions SDK when the arguments to beginShareFlow() fail validation: "Begin Share Param Validation Error." Customized sharing lets a webview page send a formatted message, usually a generic template with your own button, into a conversation the person chooses, and the SDK checks the payload before it opens the share sheet.
Meta's error-codes table lists a family of narrower SDK codes for the same flow, which are a good map of what can be wrong: 2071014 invalid message content, 2071015 and 2071016 invalid title or subtitle, 2071017 and 2071018 invalid image or item URL, 2071019 invalid button data, 2071020 missing URL data, 2071021 invalid sharingType, and 2071022 through 2071025 for invalid attachments, non-template attachment types, bad payloads and bad open graph URLs. 2018163 is the general form; treat those as the checklist.
No message was shared when this fires. The webview, the bot and the Send API are unaffected.
What it looks like
MessengerExtensions.beginShareFlow(
function success(response) {
// response.is_sent tells you whether the message was shared
},
function error(errorCode, errorMessage) {
// 2018163: the message object or sharing mode failed validation
console.error(errorCode, errorMessage);
},
{
attachment: {
type: "template",
payload: {
template_type: "generic",
elements: [{
title: "Your table is booked",
image_url: "https://example.com/table.jpg",
buttons: [{ type: "web_url", url: "https://example.com/booking", title: "View booking" }]
}]
}
}
},
"broadcast" // or "current_thread"
);Why it happens
- An invalid sharingType argument.
- Message content whose attachment type is not template, or whose payload is malformed.
- Missing or invalid title, subtitle, image_url or item URLs in the template element.
- Button definitions that do not match the share-flow format.
- Calling beginShareFlow() on a client that does not support sharing.
How to fix Messenger error 2018163
- 1Validate the message content against the share template format before calling beginShareFlow().
- 2Use a valid sharingType value and an attachment of type template.
- 3Use absolute https URLs for images and buttons.
- 4Check getSupportedFeatures() for sharing support first.
- 5Strip the payload down to one element and one button, then add fields back one at a time.
How to stop it recurring
Build share payloads from a tested function with a fixed schema rather than ad hoc objects, and run it through a validation test. Respect the platform rule against incentivized or deceptive sharing, and only open the share flow after the person taps a share control.
Official reference: Meta for Developers - Messenger Platform error codes. See all Messenger error codes or the Messenger limits and quotas.
Related codes
- 2071010: SDK method not supported on this Messenger clientThis SDK method is not supported on this Messenger client. Please upgrade
- 2071011: Messenger Extensions are not enabledMessenger Extensions are not enabled - could be "messenger_extensions" was not…
- 2018154: Messenger Extensions unexpected errorMessenger Extensions unexpected error
Error 2018163 - quick answers
What does Messenger error 2018163 mean?
Code 2018163 is returned by the Messenger Extensions SDK when the arguments to beginShareFlow() fail validation: "Begin Share Param Validation Error." Customized sharing lets a webview page send a formatted message, usually a generic template with your own button, into a conversation the person chooses, and the SDK checks the payload before it opens the share sheet.
How do I fix Messenger error 2018163?
1. Validate the message content against the share template format before calling beginShareFlow(). 2. Use a valid sharingType value and an attachment of type template. 3. Use absolute https URLs for images and buttons. 4. Check getSupportedFeatures() for sharing support first. 5. Strip the payload down to one element and one button, then add fields back one at a time.
Stop debugging Messenger by hand
Connect the channel through Conferbot: tokens, webhooks and retries are handled, failures show as readable status.