Portal Community
This operation is permanent. Deleting a media object removes it from Meta's servers immediately. Any message that currently displays that media will show a broken attachment to the recipient. Always archive the content with media/download before deleting.

When to Use

Configuration

Connection

FieldRequiredDescription
accessTokenRequiredPermanent System User access token from Meta Business Manager. Store in BizFirst Credentials Manager.
phoneNumberIdRequiredNumeric string ID of the WhatsApp Business phone number that owns the media object.
apiVersionOptionalMeta Graph API version, e.g. v18.0. Defaults to v18.0.

Operation

FieldRequiredDescription
mediaIdRequiredThe ID of the media object to delete. Must have been uploaded by or received on the same phone number account. Deletion of another account's media returns a 100 error.

Sample Configuration

{
  "resource": "media",
  "operation": "delete",
  "accessToken": "{{ $credentials.whatsAppToken }}",
  "phoneNumberId": "123456789012345",
  "mediaId": "{{ $input.mediaIdToDelete }}"
}

Validation Errors

ErrorCause
accessToken is requiredThe accessToken field is empty or missing.
phoneNumberId is requiredThe phoneNumberId field is empty or missing.
mediaId is requiredThe mediaId field is empty or missing.
100 (Meta)Media ID not found or the calling account does not have permission to delete it.
190 (Meta)Access token expired or invalid.
parse_errorMeta returned a non-JSON response. Treat as transient and retry once.

Output

Success Port

Fires when Meta confirms the media has been deleted. The status field will be "deleted".

FieldTypeDescription
statusstring"deleted" on success.
errorCodestringEmpty on success.
errorMessagestringEmpty on success.
rawResponsestringFull raw JSON response from Meta, typically {"success":true}.

Error Port

Fires when the deletion fails. Inspect the errorCode to distinguish between a not-found error (100) and an authentication error (190).

FieldTypeDescription
statusstring"failed" or "error".
errorCodestringMeta error code or BizFirst internal code.
errorMessagestringHuman-readable description of the failure.
rawResponsestringRaw API error JSON for diagnostics.

Sample Output

{
  "status": "deleted",
  "errorCode": null,
  "errorMessage": null,
  "rawResponse": "{\"success\":true}"
}

Expression Reference

ValueExpressionNotes
Status{{ $output.deleteMedia.status }}"deleted" on success. Use in an IfCondition to confirm before updating a database record.
Error code{{ $output.deleteMedia.errorCode }}Non-null on error port. Code 100 means already deleted or never existed.
Error message{{ $output.deleteMedia.errorMessage }}Human-readable reason for failure. Log for audit trail.
Raw response{{ $output.deleteMedia.rawResponse }}Full JSON confirmation string from Meta.

Node Policies & GuardRails

Policy AreaRecommendation
Archive before deleteAlways call media/download and confirm archival success before calling this node. A deletion cannot be undone.
IdempotencyAttempting to delete an already-deleted media ID returns error 100. In cleanup workflows, treat 100 as a success condition (already deleted) to prevent false alarms.
Credential storageStore the access token in BizFirst Credentials Manager. Never expose it in node configuration as plain text.
Audit loggingRecord the mediaId, timestamp, and the identity of the triggering user or process in an immutable audit log before and after deletion. This is essential for GDPR compliance.
Batch operationsFor bulk deletion (e.g. post-campaign cleanup), use a Loop node to iterate over a list of media IDs, with a Delay node between calls to respect Meta API rate limits.
Error port handlingAlways connect the error port. Failure to delete should be logged and escalated — silently ignoring delete failures can result in data residency policy violations.

Examples

GDPR Erasure Workflow

{
  "resource": "media",
  "operation": "delete",
  "accessToken": "{{ $credentials.whatsAppToken }}",
  "phoneNumberId": "123456789012345",
  "mediaId": "{{ $loop.currentItem.mediaId }}"
}

A data erasure workflow retrieves all media IDs associated with a departing customer from a database, loops through them, archives each one (via media/download), and then calls this node. On success, the workflow marks each record as deleted in the audit log. On error with code 100, it marks the record as already-deleted and continues.

Post-Campaign Cleanup

{
  "resource": "media",
  "operation": "delete",
  "accessToken": "{{ $credentials.whatsAppToken }}",
  "phoneNumberId": "123456789012345",
  "mediaId": "{{ $loop.currentItem.campaignMediaId }}"
}

A scheduled workflow fires the day after a marketing campaign ends. It queries the campaign_assets table for all media IDs associated with the completed campaign and loops through them, calling this node for each. Successful deletions are logged; failures are collected into an error list and emailed to the campaign manager.

Transactional Rollback

{
  "resource": "media",
  "operation": "delete",
  "accessToken": "{{ $credentials.whatsAppToken }}",
  "phoneNumberId": "123456789012345",
  "mediaId": "{{ $input.orphanedMediaId }}"
}

A payment workflow uploads a receipt image, then attempts to send it. If the send fails for a business reason (e.g. payment reversal), the workflow branches to this node to delete the orphaned upload, preventing it from taking up media storage quota and eliminating any risk of the receipt being associated with the wrong transaction.