使用“在Spotify上播放”按钮将故事上传到Instagram

时间:2019-09-04 20:40:18

标签: php api instagram

我正在尝试使用this API创建一个Instagram故事。到目前为止,我可以在Instagram中创建故事,但是没有“在Spotify上播放”按钮。这就是我的意思 enter image description here

我尝试了以下代码:

// upload story
$metadata = [
      'story_app_attribution' => [
            'app_action_text' => 'Play on Spotify',
            'app_icon_url' => 'https://instagram.fods1-1.fna.fbcdn.net/v/t51.12442-15/29740079_2048812088668836_4134550447078189559_n.png?_nc_ht=instagram.fods1-1.fna.fbcdn.net&oh=3612f453da310ce260391499e1d0ab88&oe=5D95B149',
            'content_url' => 'https://open.spotify.com/track/7DcvwMAiqKJQD1rrdfxSDx?si=f_J0wbVHQCmqC6bIZvArvA&utm_source=instagram&utm_medium=ig_stories',
            'id' => 174829003346,
            'link' => 'com.spotify.music',
            'name' => 'Spotify',
        ],
];

try {
    // Also note that it has lots of options, so read its class documentation!
    $photo = new \InstagramAPI\Media\Photo\InstagramPhoto($photoFilename, ['targetFeed' => \InstagramAPI\Constants::FEED_STORY]);
    $ig->story->uploadPhoto($photo->getFile(), $metadata);
} catch (\Exception $e) {
    echo 'Something went wrong: '.$e->getMessage()."\n";
}

最后我得到一个普通的Instagram故事,里面只有一张照片。

0 个答案:

没有答案