Mr.D
Mr.D

Reputation: 7873

Facebook Messenger, Temporary send message failure when sending receipt

I want to send to user my receipt with dummy data.

I use this library which simplifies message sending to Facebook.

The structure of my payload is this:

var payload = {
    template_type: 'receipt',
    recipient_name: '@' + user.name + ' ' + user.surname,
    order_number: (new Date).getTime(),
    currency: 'USD',
    payment_method: 'Наличными',
    order_url: 'http://www.example.com',
    timestamp: (new Date).getTime() + '',
    elements: [
        {
            title: title,
            subtitle: subtitle,
            quantity: 1,
            price: 20,
            currency: 'USD',
            image_url: image_url
        }
    ],
    address: {
        street_1:"Nurly tau",
        street_2:"",
        city:"Almaty",
        postal_code:"050000",
        state:"KZ",
        country:"KZ"
    },
    summary: {
        subtotal: 20,
        shipping_cost: 0,
        total_tax: 0,
        total_cost: 20
    },
    adjustments: []
};

I have just filled receipt fields with simple fake data. Also, Facebook tracks the uniqueness of order_numbers of all sent recepts.

When I try to send this receipt I receive an error message:

{ message: '(#1200) Temporary send message failure. Please try again later',
  type: 'OAuthException',
  code: 1200,
  fbtrace_id: 'BHmHRCEQUC4' }

What does this error mean? Facebook's error messages are so enigmatic?

Upvotes: 1

Views: 1437

Answers (2)

I just had the same problem and after some fiddling I figured it out! The problem is that when you construct the timestamp using (new Date).getTime() it returns the amount of miliseconds since epoch. However, Facebook requires it to be in seconds.

Upvotes: 7

ttan_
ttan_

Reputation: 76

I had the same problem, after a lot of tries, I figured out that the problem is with the timestamp parameter passed with the JSON payload.

I have no clue about what it could be, but it worked for me removing that. (Maybe, the timestamp should be for a moment before the API call, I don't know).

Upvotes: 5

Related Questions