Were there any West African kingdoms that successfully opposed slavery?
Yes, there were. The most successful and notable example was probably the Kingdom of Benin what is now southern Nigeria (not to be confused with the modern-day state of Benin). As early as 1514, the oba (King) of Benin sent an embassy to Portugal to protest the slaving activities of Portuguese subjects in the Gulf of Guinea. Two years later, in 1516, Benin completely banned the export of male slaves. Benin still traded with Europeans, but it exported goods like cloth, pepper, and ivory rather than slaves. This ban was still in effect as late as 1701, when the Dutch traveler David van Nyendael went to Benin and left an exhaustive account of the kingdom, contained in Willem Bosman's A New and Accurate description of the Coast of Guinea, originally published in 1704. By the later 18th century, however, Benin had eased this restriction and was trading in male slaves, though it never became a major exporter. It is unclear why this change occurred, but it seems to have been a result of economic pressures; by the 18th century, Europe's demand for slaves had skyrocketed (more slaves were exported from Africa to the Americas during the 18th century than in the 16th, 17th, and 19th centuries combined), and at the same time, European demand for native African goods plummeted, so various factions within Benin who sought access to European goods seem to have pushed for allowing slave exports despite some two centuries of successful prohibition.
Other African kingdoms also attempted to restrict or regulate the slave trade, but for a variety of reasons were often much less successful than Benin. King Afonso I of Kongo, for instance, wrote a letter in 1526 to King João III of Portugal wherein he expressed his desire that Kongo "should be a place neither of trade nor of transit of slaves." However, the Portuguese ignored Afonso's request, and continued to engage in procuring slaves from Kongo. Unlike the monarchy in Benin, the Kongolese monarchy was too weak to enforce a total ban on the slave trade; instead, there was a continuous struggle between government agents who sought to impose regulations and private traders (both African and European) who sought to undermine them, with the long-term effect being the gradual depopulation of Kongo and the erosion of state authority. Agaja Trudo of Dahomey is another, later example of an African king who sought to restrict the slave trade. In 1725, he sent an emissary to England to request trade in commodities other than slaves, but was ignored. In retaliation, Dahomean troops attacked and destroyed European slaving posts at Allada and Whydah in the late 1720s, blocked inland trade routes, and enforced restrictions on slave trading. However, the later kings of Dahomey returned to slave trading, and indeed, Dahomey was one of the biggest exporters of slaves during the late 18th century.