Anchor to section titled 'undefined'

marketingActivityUpdateExternal
mutation

Requires write_marketing_events access scope.

Update an external marketing activity.


The input field for updating an external marketing activity.

The ID of the marketing activity. Specify either the marketing activity ID, remote ID, or UTM to update the marketing activity.

The ID of an activity that's hosted outside of Shopify. Specify either the marketing activity ID, remote ID, or UTM to update the marketing activity.

Specifies the Urchin Traffic Module (UTM) parameters that are associated with a related marketing campaign. Specify either the marketing activity ID, remote ID, or UTM to update the marketing activity.


Was this section helpful?

The updated marketing activity.

The list of errors that occurred from executing the mutation.


Was this section helpful?

Examples

Hide code
DescriptionCopy
mutation marketingActivityUpdateExternal($remoteId: String!, $updateInput: MarketingActivityUpdateExternalInput!) {
  marketingActivityUpdateExternal(remoteId: $remoteId, input: $updateInput) {
    marketingActivity {
      id
      title
      marketingEvent {
        manageUrl
        previewUrl
      }
    }
  }
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation marketingActivityUpdateExternal($remoteId: String!, $updateInput: MarketingActivityUpdateExternalInput!) { marketingActivityUpdateExternal(remoteId: $remoteId, input: $updateInput) { marketingActivity { id title marketingEvent { manageUrl previewUrl } } } }",
 "variables": {
    "remoteId": "abcdefg",
    "updateInput": {
      "title": "New Title",
      "remoteUrl": "https://example.com",
      "remotePreviewImageUrl": "https://example.com",
      "status": "PAUSED"
    }
  }
}'
const { admin } = await authenticate.admin(request);

const response = await admin.graphql(
  `#graphql
  mutation marketingActivityUpdateExternal($remoteId: String!, $updateInput: MarketingActivityUpdateExternalInput!) {
    marketingActivityUpdateExternal(remoteId: $remoteId, input: $updateInput) {
      marketingActivity {
        id
        title
        marketingEvent {
          manageUrl
          previewUrl
        }
      }
    }
  }`,
  {
    variables: {
      "remoteId": "abcdefg",
      "updateInput": {
        "title": "New Title",
        "remoteUrl": "https://example.com",
        "remotePreviewImageUrl": "https://example.com",
        "status": "PAUSED"
      }
    },
  },
);

const data = await response.json();
session = ShopifyAPI::Auth::Session.new(
  shop: "your-development-store.myshopify.com",
  access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
  session: session
)

query = <<~QUERY
  mutation marketingActivityUpdateExternal($remoteId: String!, $updateInput: MarketingActivityUpdateExternalInput!) {
    marketingActivityUpdateExternal(remoteId: $remoteId, input: $updateInput) {
      marketingActivity {
        id
        title
        marketingEvent {
          manageUrl
          previewUrl
        }
      }
    }
  }
QUERY

variables = {
  "remoteId": "abcdefg",
  "updateInput": {
    "title": "New Title",
    "remoteUrl": "https://example.com",
    "remotePreviewImageUrl": "https://example.com",
    "status": "PAUSED"
  }
}

response = client.query(query: query, variables: variables)
const client = new shopify.clients.Graphql({session});
const data = await client.query({
  data: {
    "query": `mutation marketingActivityUpdateExternal($remoteId: String!, $updateInput: MarketingActivityUpdateExternalInput!) {
      marketingActivityUpdateExternal(remoteId: $remoteId, input: $updateInput) {
        marketingActivity {
          id
          title
          marketingEvent {
            manageUrl
            previewUrl
          }
        }
      }
    }`,
    "variables": {
      "remoteId": "abcdefg",
      "updateInput": {
        "title": "New Title",
        "remoteUrl": "https://example.com",
        "remotePreviewImageUrl": "https://example.com",
        "status": "PAUSED"
      }
    },
  },
});
use Shopify\Clients\Graphql;

$client = new Graphql("your-development-store.myshopify.com", $accessToken);
$query = <<<QUERY
  mutation marketingActivityUpdateExternal($remoteId: String!, $updateInput: MarketingActivityUpdateExternalInput!) {
    marketingActivityUpdateExternal(remoteId: $remoteId, input: $updateInput) {
      marketingActivity {
        id
        title
        marketingEvent {
          manageUrl
          previewUrl
        }
      }
    }
  }
QUERY;

$variables = [
  "remoteId" => "abcdefg",
  "updateInput" => [
    "title" => "New Title",
    "remoteUrl" => "https://example.com",
    "remotePreviewImageUrl" => "https://example.com",
    "status" => "PAUSED",
  ],
];

$response = $client->query(["query" => $query, "variables" => $variables]);
Hide code
Input variables
Copy
{
  "remoteId": "abcdefg",
  "updateInput": {
    "title": "New Title",
    "remoteUrl": "https://example.com",
    "remotePreviewImageUrl": "https://example.com",
    "status": "PAUSED"
  }
}
Hide code
Response
JSON
{
  "marketingActivityUpdateExternal": {
    "marketingActivity": {
      "id": "gid://shopify/MarketingActivity/36187062",
      "title": "New Title",
      "marketingEvent": {
        "manageUrl": "https://example.com",
        "previewUrl": "https://example.com"
      }
    }
  }
}