example.rb in whatsapp_sdk-0.5.1 vs example.rb in whatsapp_sdk-0.6.0

- old
+ new

@@ -1,6 +1,5 @@ - # frozen_string_literal: true # 1) Copy this code into a file and save it `example.rb` # 2) Replace the `ACCESS_TOKEN` constant with a valid `access_token`. # 3) Run the file with the command `ruby example.rb` @@ -10,26 +9,26 @@ gemfile(true) do source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } - gem "whatsapp_sdk", path: "/Users/ignaciochiazzo/src/whatsapp_sdk" # "~> 0.5.0" + gem "whatsapp_sdk" gem "pry" gem "pry-nav" end require 'whatsapp_sdk' require "pry" require "pry-nav" ################# UPDATE CONSTANTS ################# -ACCESS_TOKEN = "EAAZAvvr0DZBs0BAHyg1bIPxEVV8dfI6woMaCxGNdjEEWYbZAkrMDuSqJcwXuIX10AmUW5TQLMEQCHM07dYzpGW5rTbZCZAoDt0aixPyZBB2nKFCTGhd3OnyZCZCzAxEdZBbZC4IY9uYkYbC9KCSLfOpAdgBU1dLGCTR2brwAvpWZAosgjXwgQZBLwrOSEpblsMVTGDkNaxAbi8zZBLijYRi6gsaSK" # replace this with a valid access_token # TODO replace -BUSINESS_ID = 102261539298487 -SENDER_ID = 111591145018464 -RECIPIENT_NUMBER = 13437772910 -IMAGE_LINK = "https://ignaciochiazzo.com/static/4c403819b9750c8ad8b20a75308f2a8a/876d5/profile-pic.avif" +ACCESS_TOKEN = "<TODO replace>" +SENDER_ID = "<TODO replace>" +RECIPIENT_NUMBER = "<TODO replace>" +BUSINESS_ID = "<TODO replace>" +IMAGE_LINK = "<TODO replace>" ################# Initialize Client ################# WhatsappSdk.configure do |config| config.access_token = ACCESS_TOKEN end @@ -45,11 +44,10 @@ ################################################## medias_api = WhatsappSdk::Api::Medias.new messages_api = WhatsappSdk::Api::Messages.new phone_numbers_api = WhatsappSdk::Api::PhoneNumbers.new -binding.pry ############################## Phone Numbers API ############################## registered_number = phone_numbers_api.registered_number(SENDER_ID) registered_numbers = phone_numbers_api.registered_numbers(BUSINESS_ID) ############################## Media API ############################## @@ -88,10 +86,10 @@ # messages_api.read_message(sender_id: SENDER_ID, message_id: msg_id) ######### SEND AN IMAGE # Send an image with a link image_sent = messages_api.send_image( - sender_id: SENDER_ID, recipient_number: RECIPIENT_NUMBER, link: media.url, caption: "Testing" + sender_id: SENDER_ID, recipient_number: RECIPIENT_NUMBER, link: media.url, caption: "Ignacio Chiazzo Profile" ) print_message_sent(image_sent) # Send an image with an id messages_api.send_image(