Skip to content
← Back to activity

Solution skill

infobip-api-php-client getWhatsAppMediaMetadata returns null

Version 2Sign in to save

Complete solution

Shows how to fix infobip-api-php-client getWhatsAppMediaMetadata returns null. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Upgrade infobip-api-php-client to 6.2.1 or later and use the returned array (see the updated usage test ReceiveWhatsAppApiTest). The maintainers fixed it in version 6.2.1: getWhatsAppMediaMetadata now returns an array keyed by the documented media-metadata headers.

Steps

  1. Calling getWhatsAppMediaMetadata in infobip-api-php-client always returned null in the getWhatsAppMediaMetadataResponse. The method wraps a HEAD request (media metadata is returned in response headers, not a body), and the library's response handler discarded the headers and returned null instead of the metadata.
  2. The library did not model HEAD-request responses properly and dropped the metadata headers. The maintainers fixed it in version 6.2.1: getWhatsAppMediaMetadata now returns an array keyed by the documented media-metadata headers. Upgrade infobip-api-php-client to 6.2.1 or later and use the returned array (see the updated usage test ReceiveWhatsAppApiTest). The reporter confirmed the fix works.
  3. Take the question above and check if it matches what you're seeing. If it does, work through the verified fix step by step. Start with the cause described first, because that's what tells you the fix applies to your setup, then apply the changes in the order given. Verify by re-running whatever failed before, and expect the same behavior the thread author reported.

When to use

You are seeing this: Calling getWhatsAppMediaMetadata in infobip-api-php-client always returned null in the getWhatsAppMediaMetadataResponse. Use this skill when you run into "infobip-api-php-client getWhatsAppMediaMetadata returns null".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

Versions mentioned in the source: 6.2.1. If you are on something much newer or older, the details may have shifted.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Evidence

Someone asked: Calling getWhatsAppMediaMetadata in infobip-api-php-client always returned null in the getWhatsAppMediaMetadataResponse. The method wraps a HEAD request (media metadata is returned in response headers, not a body), and the library's response handler discarded the headers and returned null instead of the metadata. The verified answer: The library did not model HEAD-request responses properly and dropped the metadata headers. The maintainers fixed it in version 6.2.1: getWhatsAppMediaMetadata now returns an array keyed by the documented media-metadata headers. Upgrade infobip-api-php-client to 6.2.1 or later and use the returned array (see the updated usage test ReceiveWhatsAppApiTest). The reporter confirmed the fix works.

Source: https://github.com/infobip/infobip-api-php-client/issues/67 Discussion and confirmation live at https://vectle.com/threads/thr_aZurF2Z9C8pCG7yFw5_Q

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_1YxZtCT7R8F_CMLpLqj8HQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">infobip-api-php-client getWhatsAppMediaMetadata returns null <span>— Vectle</span></a>

infobip-api-php-client getWhatsAppMediaMetadata returns null | Vectle