Sending gift to facebook friend from external website - facebook

I tried to use XFBML:
<fb:serverfbml style="width: 755px;">
<script type="text/fbml">
<fb:fbml>
<fb:request-form action="http://example.com/user/handleFacebookGiftSend" method="POST" invite="false" type="gifts"
<fb:multi-friend-selector
....................
on a webpage on my website to send virtual gift (consisting of simply an image and a message) to selected friends on facebook.
But then it is sent as application request ( like request to add application) even thought the application is already added by the user to whom gift is being sent. In this case the application is not facebook canvas application but an external web application running outside of facebook.
This is not right way to send a virtual gift. Ideally this should be sent as a private message to user facebook inbox informing the user that he has a gift and to view the gift, click on the link given in the message. But this option is not available. Am I right about this?
Notification would be the next best option. Is this also not available?
If none of the above available, how do I send the virtual gift link to user without showing up as application request?
Help would be greatly appreciated as I spent considerable amount of time on this before posting here.

This might be used, if you extend a MultyFriendSelector you should send an URL specified with parameters in order that it you comes back to a definite direction depending on the parameters, you might use the return of call when the user does click in the request, this one would send you to the direction URL that you find ordered in the link of the button to confirm.
For example if you want to order a gift that would be a simple image you should define in the direction of return the location of the image in your server.
<fb:fbml>
<fb:request-form
action="index.php"
method="POST"
invite="false"
type="HalloweenMosters"
content="You have received a gift from HalloweenMosters. <?php echo htmlentities("<fb:req-choice url=\"http://apps.facebook.com/YOR APP/Gifts_Manager.php?key_api="YOUR AP ID&idGift=" "\" label=\"Send a gift\"") ?>">
<fb:multi-friend-selector
email_invite="false"
import_external_friends="false"
condensed='false'
actiontext="To donate an adorable Monster to a friend"
showborder="false" rows="3" cols="4"/>
</fb:request-form>
</fb:fbml>
I hope that sickle serves...

Related

add send to messenger button in email

I am making a feedback system using a facebook messenger bot. When the order is completed, then a email will be send to the user for feedback. I wanted to add "send to messenger" button in the email so that after clicking that button, a auto generated message will be send to the user's messenger for asking the feedback.
I have completed all the steps but I am not able to send the button in mail. The button does not show in the mail. The bot is still not published yet.
So how can I make the button to show?
Here is my index.html page:
<div>
<div class="fb-send-to-messenger"
messenger_app_id='1133966933290445'
page_id='944059262358972'
data-ref="123556"
color="blue"
size="standard">
</div>
</div>
<div>
<p>The "Message Us" plugin takes the user directly to Messenger and into a thread with your Page.</p>
<div class="fb-messengermessageus"
messenger_app_id='1133966933290445'
page_id='944059262358972'
color="blue"
size="standard">
</div>
</div>
I am copying the view from the browser to email. I am not using node mailer now. Is it possible to work this way if the app is still under development?

Google DFP ads in email behaving strangely

I am trying out serving DFP ads in email. I'm following the guidelines here.
I have an ad unit set up just for email
I have a line item targeting that ad unit with just an image creative
The line item doesn't have any targeting restrictions or anything like that
The ad will show up in the email, at least the first time. The strange thing that I'm seeing is, after the first click, clicking on the ad again will often bring me to a blank page rather than the click-through page of the creative. Also, when I reopen the message, occasionally the image will not load. The code in the email looks like this:
<a href="https://pubads.g.doubleclick.net/gampad/jump?iu=/{my_pub_id}/300x250_email&sz=300x250&c={cachebuster}&tile=1">
<img src="https://pubads.g.doubleclick.net/gampad/ad?iu=/{my_pub_id}/300x250_email&sz=300x250&c={cachebuster}&tile=1" />
</a>
We've solved this by turning off cookies in the standard tag using the co= option; adding co=1 to the tag.
<a href="https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/{my_pub_id}/300x250_email&sz=300x250&c={cachebuster}&tile=1">
<img src="https://pubads.g.doubleclick.net/gampad/ad?co=1&iu=/{my_pub_id}/300x250_email&sz=300x250&c={cachebuster}&tile=1" />
</a>
The only problem (for us) that this creates is that we're unable to serve 3rd party tags, even ones that resolve directly to .gifs, using the standard tag.
Had the same problem and I solved it by using script to redirect click via script on my web server where ad is shown again so that all the cookies can be set.
Link looks like this:
http://www.mysite.com/dfpclick.php?adunit=mailing&cbuster=1369608725
Script dfpclick.php:
<?php
/* Google DFP url redirect*/
if ($_REQUEST['adunit']) {
$sUrl = 'http://pubads.g.doubleclick.net/gampad/jump?iu=/%mygoogleid%/'.$_REQUEST['adunit'].'&sz=1x1&c='.$_REQUEST['cbuster'];
}
?>
<html>
<head>
<meta HTTP-EQUIV="REFRESH" content="0; url=<?=$sUrl?>">
</head>
<body>
<?php
if ($_REQUEST['adunit']) {
echo '<img src="http://pubads.g.doubleclick.net/gampad/ad?iu=/%mygoogleid%/'.$_REQUEST['adunit'].'&sz=1x1&c='.$_REQUEST['cbuster'].'" width="0" height="0" border="0" style="width:0px; height:0px;" alt=""/>';
}
?>
</body>
</html>
It turns out that DFP for small business requires cookie support to work, even when using the non-JavaScript method of calling ads. So it works fine in web-based clients like Gmail, but it doesn't work in Outlook and the like. DFP Premium can supposedly serve ads in email without requiring cookies.
Using the co= option doesn't work for DFP Small Business. My workaround is:
Use the same code for img <img src="https://pubads.g.doubleclick.net/gampad/ad?iu=/{my_pub_id}/300x250_email&sz=300x250&c={cachebuster}" />
And build a redirect link on your website <a href="http://yourwebsite.com/adunit/300x250_email">. This page reads and filters the response from http://pubads.g.doubleclick.net/gampad/adx?iu=/{my_pub_id}/300x250_email&sz=300x250&c={cachebuster} in order to get the click-tracking link using javascript link=$(xmlDoc).find('a').attr('href'); and redirect.
This workaround doesn't work for rotation (more than one creative/line item is competing for the same ad unit at the same time).
I'd like to know how to serve email ads in rotation using DFP SB

Submit button action

<FORM ID='htmlform' action="" onsubmit="return valforms(this)">
.....
<INPUT TYPE="submit" NAME="submit" VALUE="Submit">
When the user is done filling out the form, and clicks the submit button, I want all of the form information to be sent to me. How do I do this? This is only part of the code, the whole code is too long for me to type in here.
To reply on your question:
Oh, so like the page that emails the data is that an html page that I can have a message saying, "Thank you for your interest, you will hear back from us soon." and then have the page redirect to the home page again? I hope I'm not getting too complicated with this
You're almost right. Let me explain it to you:
the user gets a HTML page that was made in PHP, ASP,.. to fill in
some data in a form
the user fills in the data and clicks a button
The action on the button tells the server to process the page, or have another page to process it. Let's call this page PageX
PageX (written in PHP, ASP,...) will email the data to you
You can also have pageX return some text to the user's browser saying "thank you for your interest,....". You can also make a redirect to another page from this page
Does this answer your question?
The action part of the form element tells the browser what URL to post the information to. You would need to specify some page with some server-side code that would take that information and store it or send it in an email. The onsubmit part of your form element fires a JavaScript event that can be handled on the client's machine. You cannot do much on the client's machine without sending the data back to the server.

fb:request-form showing blank page

This is my code
<fb:serverFbml style="width: 760px;">
<script type="text/fbml">
<fb:fbml>
<fb:request-form
action="http://apps.facebook.com/MyAPP/invite.php"
target="_top"
method="POST"
invite="true"
type="Invite Form"
content="<fb:req-choice url='http://www.example.com/folder/index.php' label='Accept' />"
>
If i have action="http://www.example.com/folder/invite.php" then it posts array of friends invited in invite.php page, but it takes user outside facebook interface.
If i have action="http://apps.facebook.com/MyAPP/invite.php" then it stays in facebook interface but loads a blank page for invite.php.
Any idea how to solve this?
It looks like if I have action=apps.facebook.com/MyAPP/invite.php then <fb:request-form> doesn't post the ids array to the page. So I tried action="MyDomain.com/folder/invite.php"; and it gave me the ids in and array which I stored in a session and then have this page redirect the user back to apps.facebook.com/MyAPP. There I checked the number array processed it the way I wanted. Not sure this is best way to go about it though.

facebook error The page you requested was not found. - When inviting friends to join

I am a .net developer, using iframe xfbml and asp.net of course.
I am getting the following error:
The page you requested was not found.
You may have clicked an expired link or mistyped the address. Some web addresses are case sensitive.
* Return home
* Go back to the previous page
I am using the request-form tag as following:
<fb:request-form target="_top" action="http://apps.facebook.com/myapp"
method="POST" invite="true" type="myappliation"
content="come see
<fb:req-choice url='http://apps.facebook.com/myapp' label='i am coming' /> " >
<fb:multi-friend-selector rows="3" showborder="false" actiontext="its now shame to ask for help!" max="10" style="height:100px;" target="_top" />
</fb:request-form>
This code is working for some of the users, but for new ones they recieve that error. Why is that happening? How can I fix it?
I'm experiencing the same problem for a while. I tried with 2 applications, same configuration, with inviting the same user, and it's working for one of them but not the other...
By browsing similar post, I found no other solution except using the old API (see this post related) :
Facebook multi-friend-selector + new javascript API = BROKEN?
However, this does not help me since, I need the FB.ui function to pop up a dialog...
Facebook bugs me !