SOLVED

Re: Pre-populated tweet

Go to solution
KatieWainwright
Level 2

Pre-populated tweet

Hi, 

 

I am trying to create a link for a pre-populated tweet. I have followed numerous resources however I only create a link that pre-populates a link for the customer to share, I am looking to create a link for a pre populated tweet that has text as aswell as the link. 

 

Basically I want the link to direct them to twitter and give them a pre populated tweet which would look something like this, 

 

I'm taking part in X campaign, join me (website link) #campaignname 

 

Has anyone done this and can advise?

 

Thanks, 

 

Katie

1 ACCEPTED SOLUTION

Accepted Solutions
TyrellC
Level 2

Re: Pre-populated tweet

Hey @KatieWainwright,

 

If I understand you correctly, you will want to use the Web Intent URL.

 

It can be formatted as such: https://twitter.com/intent/tweet?text=hello%20world&url=https://mergeworld.com/&via=wearemerge

(I am using the agency I work at URL and Twitter @ for an example).

 

This link would generate a tweet like so:

Screenshot 2023-10-19 at 11.43.47 AM.png

 

To provide some guidance on structuring the URL, this is how it works:

https://twitter.com/intent/tweet is the base URL

 

You then add a '?' to the end of the URL like this:

https://twitter.com/intent/tweet?

This allows you to start adding the parameters. Let's add text that says 'I'm taking part in X campaign, join me'

 

You would put the parameter after the '?' in this case, 'text' (as referenced in the Web Intent URL page), and begin inputting your tweet text:

https://twitter.com/intent/tweet?text=I'm%20taking%20part%20in%20X%20campaign,%20join%20me

 

As you can see, for spaces, you use the %20 between the words in the URL.

If you would then like to add a link, you simply add a '&' to the end of the link to indicate you are adding a new parameter. For this example adding a link, the parameter is simply 'url'. So adding a link to https://mergeworld.com/ for example would be done like such:

https://twitter.com/intent/tweet?text=I'm%20taking%20part%20in%20X%20campaign,%20join%20me&url=https://mergeworld.com/

 

This is the tweet generated from that link:

Screenshot 2023-10-19 at 11.55.53 AM.png

 

To add the hashtag, it can be appended to the link as such using the 'hashtags' parameter. Remember, I needed to add a '&' to indicate a new parameter is now being added:

 

https://twitter.com/intent/tweet?text=I'm%20taking%20part%20in%20X%20campaign,%20join%20me&url=https://mergeworld.com/&hashtags=campaignname

 

Finally, here is that result:

Screenshot 2023-10-19 at 12.05.19 PM.png  

 

There are more parameters that can be added, but it follows this same structure as shown above.

If you have any specific questions, please let me know!

 

Tip: If you have multiple hashtags, you can add them all by separating using a comma like:

&hashtags=campaignname,marketo,loremipsum

Tyrell Curry
Marketo Web Developer @ MERGE

View solution in original post

2 REPLIES 2
TyrellC
Level 2

Re: Pre-populated tweet

Hey @KatieWainwright,

 

If I understand you correctly, you will want to use the Web Intent URL.

 

It can be formatted as such: https://twitter.com/intent/tweet?text=hello%20world&url=https://mergeworld.com/&via=wearemerge

(I am using the agency I work at URL and Twitter @ for an example).

 

This link would generate a tweet like so:

Screenshot 2023-10-19 at 11.43.47 AM.png

 

To provide some guidance on structuring the URL, this is how it works:

https://twitter.com/intent/tweet is the base URL

 

You then add a '?' to the end of the URL like this:

https://twitter.com/intent/tweet?

This allows you to start adding the parameters. Let's add text that says 'I'm taking part in X campaign, join me'

 

You would put the parameter after the '?' in this case, 'text' (as referenced in the Web Intent URL page), and begin inputting your tweet text:

https://twitter.com/intent/tweet?text=I'm%20taking%20part%20in%20X%20campaign,%20join%20me

 

As you can see, for spaces, you use the %20 between the words in the URL.

If you would then like to add a link, you simply add a '&' to the end of the link to indicate you are adding a new parameter. For this example adding a link, the parameter is simply 'url'. So adding a link to https://mergeworld.com/ for example would be done like such:

https://twitter.com/intent/tweet?text=I'm%20taking%20part%20in%20X%20campaign,%20join%20me&url=https://mergeworld.com/

 

This is the tweet generated from that link:

Screenshot 2023-10-19 at 11.55.53 AM.png

 

To add the hashtag, it can be appended to the link as such using the 'hashtags' parameter. Remember, I needed to add a '&' to indicate a new parameter is now being added:

 

https://twitter.com/intent/tweet?text=I'm%20taking%20part%20in%20X%20campaign,%20join%20me&url=https://mergeworld.com/&hashtags=campaignname

 

Finally, here is that result:

Screenshot 2023-10-19 at 12.05.19 PM.png  

 

There are more parameters that can be added, but it follows this same structure as shown above.

If you have any specific questions, please let me know!

 

Tip: If you have multiple hashtags, you can add them all by separating using a comma like:

&hashtags=campaignname,marketo,loremipsum

Tyrell Curry
Marketo Web Developer @ MERGE
SanfordWhiteman
Level 10 - Community Moderator

Re: Pre-populated tweet

Better to build this using Velocity, I'd say, so you ensure proper URL encoding (which goes beyond the space – in fact the space is the least important character to pre-encode!).